Crash in Footprint Editor with Ctrl-Enter from Enumerate Pads

Bug #1803730 reported by Seth Hillbrand
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Jeff Young

Bug Description

Start footprint editor (using Cairo mode)
Load a footprint (I used PQFP-160_28x28mm)
Start Renumber Pads
Renumber a couple pads
Press Ctrl-Return

For some reason, this started the "Move Item" dialog and then crashed.

Backtrace:
#0 0x00007fffdf64a31b in KIGFX::VIEW_GROUP::ViewDraw(int, KIGFX::VIEW*) const (this=0x5555588a88a0, aLayer=131, aView=0x55555856b7b0)
    at /home/seth/code/kicad/kicad-v5/common/view/view_group.cpp:114
#1 0x00007fffdf63ab3a in KIGFX::VIEW::draw(KIGFX::VIEW_ITEM*, int, bool) (this=0x55555856b7b0, aItem=0x5555588a88a0, aLayer=131, aImmediate=false)
    at /home/seth/code/kicad/kicad-v5/common/view/view.cpp:990
#2 0x00007fffdf63d5d0 in KIGFX::VIEW::drawItem::operator()(KIGFX::VIEW_ITEM*) (this=0x555560b7c040, aItem=0x5555588a88a0)
    at /home/seth/code/kicad/kicad-v5/common/view/view.cpp:921
#3 0x00007fffdf643a40 in RTree<KIGFX::VIEW_ITEM*, int, 2, double, 8, 4>::Search<KIGFX::VIEW::drawItem>(RTree<KIGFX::VIEW_ITEM*, int, 2, double, 8, 4>::Node*, RTree<KIGFX::VIEW_ITEM*, int, 2, double, 8, 4>::Rect*, KIGFX::VIEW::drawItem&, int&) (this=0x55555f5890b0, a_node=0x55555f5890d0, a_rect=0x555560b7bfc0, a_visitor=..., a_foundCount=@0x555560b7bfbc: 0) at /home/seth/code/kicad/kicad-v5/include/geometry/rtree.h:499
#4 0x00007fffdf6414f7 in RTree<KIGFX::VIEW_ITEM*, int, 2, double, 8, 4>::Search<KIGFX::VIEW::drawItem>(int const*, int const*, KIGFX::VIEW::drawItem&) (this=0x55555f5890b0, a_min=0x555560b7c018, a_max=0x555560b7c010, a_visitor=...) at /home/seth/code/kicad/kicad-v5/include/geometry/rtree.h:154
#5 0x00007fffdf63f0e6 in KIGFX::VIEW_RTREE::Query<KIGFX::VIEW::drawItem>(BOX2<VECTOR2<int> > const&, KIGFX::VIEW::drawItem&) (this=0x55555f5890b0, aBounds=..., aVisitor=...) at /home/seth/code/kicad/kicad-v5/include/view/view_rtree.h:85
#6 0x00007fffdf63a9b5 in KIGFX::VIEW::redrawRect(BOX2<VECTOR2<int> > const&) (this=0x55555856b7b0, aRect=...)
    at /home/seth/code/kicad/kicad-v5/common/view/view.cpp:960
#7 0x00007fffdf63b06c in KIGFX::VIEW::Redraw() (this=0x55555856b7b0) at /home/seth/code/kicad/kicad-v5/common/view/view.cpp:1096
#8 0x00007fffdf6ed86c in EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) (this=0x555559b68cf0)
    at /home/seth/code/kicad/kicad-v5/common/draw_panel_gal.cpp:187
#9 0x00007ffff66f08ce in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x00007ffff66f0cda in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x00007ffff66f0d6f in wxEvtHandler::TryHereOnly(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#12 0x00007ffff66f0e23 in wxEvtHandler::ProcessEventLocally(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#13 0x00007ffff66f0e85 in wxEvtHandler::ProcessEvent(wxEvent&) () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#14 0x00007ffff66f1ff2 in wxEvtHandler::ProcessPendingEvents() () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#15 0x00007ffff6572df7 in wxAppConsoleBase::ProcessPendingEvents() () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#16 0x00007ffff6e3b78d in wxApp::DoIdle() () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#17 0x00007ffff6e3b893 in () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#18 0x00007ffff4467ae8 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007ffff4467ed8 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007ffff44681d2 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007ffff49248e7 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#22 0x00007ffff6e5b6d5 in wxGUIEventLoop::DoRun() () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#23 0x00007ffff65acea3 in wxEventLoopBase::Run() () at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#24 0x00007ffff6ec78c3 in wxDialog::ShowModal() () at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#25 0x00007fffdf264c96 in EDIT_TOOL::MoveExact(TOOL_EVENT const&) (this=0x55555f6b0180, aEvent=...)
    at /home/seth/code/kicad/kicad-v5/pcbnew/tools/edit_tool.cpp:960
#26 0x00007fffdf26e02e in std::__invoke_impl<int, int (EDIT_TOOL::*&)(TOOL_EVENT const&), EDIT_TOOL*&, TOOL_EVENT const&>(std::__invoke_memfun_deref, int (EDIT_TOOL::*&)(TOOL_EVENT const&), EDIT_TOOL*&, TOOL_EVENT const&) (__f=
    @0x55555f3ffda0: (int (EDIT_TOOL::*)(EDIT_TOOL * const, const TOOL_EVENT &)) 0x7fffdf264bb0 <EDIT_TOOL::MoveExact(TOOL_EVENT const&)>, __t=@0x55555f3ffdb0: 0x55555f6b0180, __args#0=...) at /usr/include/c++/8/bits/invoke.h:73
#27 0x00007fffdf26def3 in std::__invoke<int (EDIT_TOOL::*&)(TOOL_EVENT const&), EDIT_TOOL*&, TOOL_EVENT const&>(int (EDIT_TOOL::*&)(TOOL_EVENT const&), EDIT_TOOL*&, TOOL_EVENT const&) (__fn=
    @0x55555f3ffda0: (int (EDIT_TOOL::*)(EDIT_TOOL * const, const TOOL_EVENT &)) 0x7fffdf264bb0 <EDIT_TOOL::MoveExact(TOOL_EVENT const&)>, __args#0=@0x55555f3ffdb0: 0x55555f6b0180, __args#1=...) at /usr/include/c++/8/bits/invoke.h:95
#28 0x00007fffdf26dbb7 in std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::__call<int, TOOL_EVENT const&, 0ul, 1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>) (this=0x55555f3ffda0, __args=...) at /usr/include/c++/8/functional:400
#29 0x00007fffdf26d73f in std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT const&) (this=0x55555f3ffda0, __args#0=...) at /usr/include/c++/8/functional:484
#30 0x00007fffdf26d2b1 in std::_Function_handler<int (TOOL_EVENT const&), std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT con---Type <return> to continue, or q <return> to quit---
st&)> >::_M_invoke(std::_Any_data const&, TOOL_EVENT const&) (__functor=..., __args#0=...) at /usr/include/c++/8/bits/std_function.h:282
#31 0x00007fffdf672b35 in std::function<int (TOOL_EVENT const&)>::operator()(TOOL_EVENT const&) const (this=0x55555dd4d608, __args#0=...)
    at /usr/include/c++/8/bits/std_function.h:687
#32 0x00007fffdf66fc8c in COROUTINE<int, TOOL_EVENT const&>::callerStub(long) (aData=140737488339712)
    at /home/seth/code/kicad/kicad-v5/include/tool/coroutine.h:329
#33 0x00007fffdf6c5221 in make_fcontext () at /usr/include/wx-3.0/wx/strconv.h:576
#34 0x0000000000000000 in ()

Application: kicad
Version: (5.0.1-36-ge2e545667), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.34.0 librtmp/2.3
Platform: Linux 4.18.0-2-amd64 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.62.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.0
    Compiler: GCC 8.2.0 with C++ ABI 1013

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

Seth Hillbrand (sethh)
Changed in kicad:
milestone: none → 5.0.2
Revision history for this message
Seth Hillbrand (sethh) wrote :

Just checked and bug exists in master as well

Application: kicad
Version: (6.0.0-rc1-dev-1189-g361b768aa-dirty), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.34.0 librtmp/2.3
Platform: Linux 4.18.0-2-amd64 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.62.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.0
    Compiler: GCC 8.2.0 with C++ ABI 1013

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

Revision history for this message
Jeff Young (jeyjey) wrote :

It doesn't crash on OSX, but it does get locked into some odd state with the Move tool.

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

I see this as @Seth describes on Linux, current master (65a967dca).

Revision history for this message
Jeff Young (jeyjey) wrote :

Two different bugs here: the Move Exact tool gets activated because of some incorrect event-handling in TOOL_DISPATCHER::DispatchWxEvent(); the crash when refreshing the view behind the dialog is unrelated (and happens even if you use the correct Crtl-M shortcut for Move Exact).

Revision history for this message
Jeff Young (jeyjey) wrote :

The other bug is because editing tools with state shouldn't call PassEvent on events they don't handle (it allows other tools to start up and so the first tools state never gets cleaned up).

Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: New → In Progress
Revision history for this message
Jeff Young (jeyjey) wrote :

Hmm... not calling PassEvent() isn't sufficient to keep MoveExact() from running.

(The crash happens because SelectCursor() is called for MoveExact(), then something triggers a cancel event for the EnumeratePads tool which cancels the BoardCommit, replacing the MODULE with the saved one, which deletes the pad that SelectCursor() selected.)

Jeff Young (jeyjey)
Changed in kicad:
importance: Undecided → High
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: In Progress → 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.