Gerbview segfault on open

Bug #1746770 reported by Seth Hillbrand
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Critical
Jon Evans

Bug Description

GerbView is segfaulting sometimes. This happens about 50% of the time when first running gerbview from the commandline. If it successfully opens, then it is about a 50/50 chance that it segfaults when trying to open a file.

Here is the backtrace from clicking on a file-open button from the toolbar.

This happens on Linux debian, running in OpenGL. It does not happen when running in legacy or fallback.

#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff35533fa in __GI_abort () at abort.c:89
#2 0x00007ffff1f7b5a5 in g_assertion_message () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff1f7b63a in g_assertion_message_expr () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007ffff29ee890 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007ffff29f758c in g_signal_handlers_disconnect_matched ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00007ffff6c6caaf in wxWindow::GTKDisconnect(void*) ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#7 0x00007ffff6c6cb5f in wxWindow::~wxWindow() () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#8 0x00007ffff6d00327 in ?? () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#9 0x00007fffdf565adf in GERBVIEW_FRAME::ReCreateAuxiliaryToolbar (this=0x555556bb3600)
    at /home/seth/code/kicad/kicad-launchpad/gerbview/toolbars_gerber.cpp:166
#10 0x00007fffdf54931e in GERBVIEW_FRAME::ReFillLayerWidget (this=0x555556bb3600)
    at /home/seth/code/kicad/kicad-launchpad/gerbview/gerbview_frame.cpp:469
#11 0x00007fffdf52d961 in GERBVIEW_FRAME::Erase_Current_DrawLayer (this=0x555556bb3600, query=false)
    at /home/seth/code/kicad/kicad-launchpad/gerbview/clear_gbr_drawlayers.cpp:88
#12 0x00007fffdf54094b in GERBVIEW_FRAME::Files_io (this=0x555556bb3600, event=...)
    at /home/seth/code/kicad/kicad-launchpad/gerbview/files.cpp:111
#13 0x00007ffff634440e in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
    () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#14 0x00007ffff64c9ea5 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#15 0x00007ffff64c9f9b in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#16 0x00007ffff64ca34b in wxEvtHandler::TryHereOnly(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#17 0x00007fffdf5ee746 in EDA_BASE_FRAME::ProcessEvent (this=0x555556bb3600, aEvent=...)
    at /home/seth/code/kicad/kicad-launchpad/common/eda_base_frame.cpp:185
#18 0x00007ffff64ca153 in wxEvtHandler::DoTryChain(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#19 0x00007ffff64ca435 in wxEvtHandler::ProcessEvent(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#20 0x00007ffff6e562f8 in wxWindowBase::TryAfter(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#21 0x00007ffff7989878 in wxAuiToolBar::OnLeftUp(wxMouseEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_aui-3.0.so.0
#22 0x00007ffff634440e in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
    () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#23 0x00007ffff64c9ea5 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#24 0x00007ffff64c9f9b in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) ()

Application: gerbview
Version: (2018-02-01 revision 3cdc6a58a)-master, debug build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.52.1 GnuTLS/3.5.8 zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Platform: Linux 4.9.0-5-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

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

Tags: gal gerbview
Revision history for this message
Jon Evans (craftyjon) wrote :

Well this is almost certainly due to 14abe8723d but I can't figure out how to reproduce. I also run Linux (Ubuntu) and test a lot with OpenGL but can't see this crash. I'm not sure why it is particular to OpenGL as this is happening in the toolbar creation.

Revision history for this message
Jon Evans (craftyjon) wrote :

Hi Seth, can you try this patch and let me know if it fixes the problem for you?

Changed in kicad:
assignee: nobody → Jon Evans (craftyjon)
Revision history for this message
Seth Hillbrand (sethh) wrote :

Thanks Jon, I can test this on Monday.

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

Jon-

This patch works nicely. I can no longer trigger the segfault. Thanks!

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

Hi Jon,

Is this patch ready for commit?

Jon Evans (craftyjon)
Changed in kicad:
status: New → Fix Committed
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.