Eeschema segfault on shutdown

Bug #1800874 reported by John Beard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
John Beard

Bug Description

To reproduce:

* Open a blank eeschema document
* Place a component (eg 4001)
* Right click component, choose move and move it.
* Repeat this action, move again.
* Close eeschema

Sometimes, not always, this segfaults:

Core was generated by `eeschema/eeschema'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f60377b7efc in DHEAD::GetCount (this=0x298) at /home/john/src/kicad/include/dlist.h:126
126 unsigned GetCount() const { return count; }
[Current thread is 1 (Thread 0x7f603f34b940 (LWP 13057))]
(gdb) bt
#0 0x00007f60377b7efc in DHEAD::GetCount() const (this=0x298) at /home/john/src/kicad/include/dlist.h:126
#1 0x00007f60378d6b59 in SCH_SCREEN::UpdateSymbolLinks(bool) (this=0x0, aForce=false)
    at /home/john/src/kicad/eeschema/sch_screen.cpp:481
#2 0x00007f603784fd7c in SCH_DRAW_PANEL::onPaint(wxPaintEvent&) (this=0x55579299ba10, aEvent=...)
    at /home/john/src/kicad/eeschema/sch_draw_panel.cpp:690
#3 0x00007f604084089e in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /usr/lib/libwx_baseu-3.0.so.0
#4 0x00007f6040840c1b in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () at /usr/lib/libwx_baseu-3.0.so.0
#5 0x00007f6040840cb1 in wxEvtHandler::TryHereOnly(wxEvent&) () at /usr/lib/libwx_baseu-3.0.so.0
#6 0x00007f6040840d64 in wxEvtHandler::ProcessEventLocally(wxEvent&) () at /usr/lib/libwx_baseu-3.0.so.0
#7 0x00007f6040840e02 in wxEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/libwx_baseu-3.0.so.0
#8 0x00007f6040841817 in wxEvtHandler::ProcessPendingEvents() () at /usr/lib/libwx_baseu-3.0.so.0
#9 0x00007f60406d39e8 in wxAppConsoleBase::ProcessPendingEvents() () at /usr/lib/libwx_baseu-3.0.so.0
#10 0x00007f6040ba879a in wxApp::DoIdle() () at /usr/lib/libwx_gtk2u_core-3.0.so.0
#11 0x00007f6040ba88b4 in () at /usr/lib/libwx_gtk2u_core-3.0.so.0
#12 0x00007f603e57b271 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#13 0x00007f603e57cf89 in () at /usr/lib/libglib-2.0.so.0
#14 0x00007f603e57df62 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
#15 0x00007f603ec2bdf3 in gtk_main () at /usr/lib/libgtk-x11-2.0.so.0
#16 0x00007f6040bc61b6 in wxGUIEventLoop::DoRun() () at /usr/lib/libwx_gtk2u_core-3.0.so.0
#17 0x00007f604070dbae in wxEventLoopBase::Run() () at /usr/lib/libwx_baseu-3.0.so.0
#18 0x00007f60406d2517 in wxAppConsoleBase::MainLoop() () at /usr/lib/libwx_baseu-3.0.so.0
#19 0x0000555790b0370f in APP_SINGLE_TOP::OnRun() (this=0x5557918633d0)
    at /home/john/src/kicad/common/single_top.cpp:186
#20 0x00007f604075a4c8 in wxEntry(int&, wchar_t**) () at /usr/lib/libwx_baseu-3.0.so.0
#21 0x0000555790afedc0 in main(int, char**) (argc=1, argv=0x7ffc2d97f7b8)
    at /home/john/src/kicad/common/single_top.cpp:260

-----

Application: eeschema
Version: (6.0.0-rc1-dev-1069-g798523455), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.1 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) libssh2/1.8.0 nghttp2/1.34.0
Platform: Linux 4.18.16-arch1-1-ARCH x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 8.2.1 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Tags: eeschema
description: updated
Revision history for this message
Jeff Young (jeyjey) wrote :

Hi John,

I can't reproduce this. Couple of questions:

1) Did you discard changes or save when closing?
2) Did you run Eeschema from a project window or stand-alone?

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I also cannot reproduce it.

However, these lines:

#1 0x00007f60378d6b59 in SCH_SCREEN::UpdateSymbolLinks(bool) (this=0x0, aForce=false)
    at /home/john/src/kicad/eeschema/sch_screen.cpp:481
#2 0x00007f603784fd7c in SCH_DRAW_PANEL::onPaint(wxPaintEvent&) (this=0x55579299ba10, aEvent=...)
    at /home/john/src/kicad/eeschema/sch_draw_panel.cpp:690

lead me to think a wxPaint event is fired after deleting the frame.

The line 690 is:
static_cast<SCH_SCREEN*>( GetScreen() )->UpdateSymbolLinks();
and clearly GetScreen() returns nullptr ( can happens after deleting the frame)

We already saw that, and it is depending on the platform.

Try this fix:
if( GetScreen() )
    static_cast<SCH_SCREEN*>( GetScreen() )->UpdateSymbolLinks();

Revision history for this message
John Beard (john-j-beard) wrote :

I discarded the changes, and ran stand-alone.

JP's fix seems to work.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Hmm... While the fix makes sense for this case, it feels like we have a deeper issue here that the events are still being triggered after we delete the screen.

This might be a reproducible issue that gives us the opportunity to fix the event ordering and remove additional bug possibilities

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision bf422479711afc196a89bf2e6ab236a0b78ac5e6
https://git.launchpad.net/kicad/patch/?id=bf422479711afc196a89bf2e6ab236a0b78ac5e6

Changed in kicad:
status: New → Fix Committed
assignee: nobody → John Beard (john-j-beard)
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.