eeschema: Assertion failure and undesired behavior placing imported hierarchical pin

Bug #1477213 reported by Ben Kempke
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
Unassigned

Bug Description

If you happen to double-click while placing an imported hierarchical pin on the parent schematic, an assertion is thrown (caught in debug mode then causing the placed pin to disappear).

Steps to reproduce:
1) Create a new project
2) Start eeschema
3) Create a hierarchical sheet
4) Open newly-created hierarchical sheet
5) Place a hierarchical label
6) Go back to parent schematic
7) Click the 'Place hierarchical pin imported from the corresponding hierarchical label' button
8) Double click to try placing the hierarchical pin

P.S. I am also not able to utilize the helpful backtrace 'Save to file' or 'Copy to clipboard' buttons. 'Save to file' opens a blank window and 'Copy to clipboard' does nothing.

Application: kicad
Version: (2015-07-22 BZR 5978)-product debug build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.9.2,wx containers,compatible with 2.8)
Platform: Linux 3.19.0-22-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=OFF
         KICAD_SCRIPTING_MODULES=OFF
         KICAD_SCRIPTING_WXPYTHON=OFF
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

#0 0x00007ffff5c69bd9 in raise (sig=5) at ../sysdeps/unix/sysv/linux/pt-raise.c:36
#1 0x00007ffff670eced in ?? () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#2 0x00007ffff670a5a1 in wxOnAssert(char const*, int, char const*, char const*, wchar_t const*) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#3 0x00007fffd3a699a4 in moveItemWithMouseCursor (aPanel=0xa50480, aDC=0x7fffffffc100, aPosition=..., aErase=true) at /home/user/repos/kicad.bzr/eeschema/schedit.cpp:660
#4 0x00007fffd3b42140 in EDA_DRAW_PANEL::CallMouseCapture (this=0xa50480, aDC=0x7fffffffc100, aPosition=..., aErase=true) at /home/user/repos/kicad.bzr/common/draw_panel.cpp:1536
#5 0x00007fffd3b3980e in EDA_DRAW_FRAME::RefreshCrossHair (this=0xa45300, aOldPos=..., aEvtPos=..., aDC=0x7fffffffc100) at /home/user/repos/kicad.bzr/common/draw_frame.cpp:1191
#6 0x00007fffd38fe755 in SCH_EDIT_FRAME::GeneralControl (this=0xa45300, aDC=0x7fffffffc100, aPosition=..., aHotKey=0) at /home/user/repos/kicad.bzr/eeschema/controle.cpp:235
#7 0x00007fffd3b40f3f in EDA_DRAW_PANEL::OnMouseEvent (this=0xa50480, event=...) at /home/user/repos/kicad.bzr/common/draw_panel.cpp:1242
#8 0x00007ffff670871e in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#9 0x00007ffff68a3f08 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x00007ffff68a400b in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x00007ffff68a43b8 in wxEvtHandler::TryHereOnly(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#12 0x00007ffff68a4443 in wxEvtHandler::ProcessEventLocally(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#13 0x00007ffff68a44a5 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#14 0x00007ffff708b32b in wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#15 0x00007ffff68a4217 in wxEvtHandler::SafelyProcessEvent(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#16 0x00007ffff6e06d43 in ?? () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#17 0x00007ffff5376d1f in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#18 0x00007ffff4d4c22f in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007ffff4d5e03c in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007ffff4d661a5 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007ffff4d668ff in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007ffff548e61c in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#23 0x00007ffff5375464 in gtk_propagate_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#24 0x00007ffff53758fb in gtk_main_do_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#25 0x00007ffff4fe8bac in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#26 0x00007ffff4606c3d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007ffff4606f20 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007ffff4607242 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007ffff52fdda3 in gtk_dialog_run () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#30 0x00007ffff6dfd959 in wxGUIAppTraits::ShowAssertDialog(wxString const&) () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#31 0x00007ffff670e3e2 in ?? () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#32 0x00007ffff670e7a0 in wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#33 0x00007ffff6dbc660 in wxApp::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#34 0x00007ffff670eb7b in ?? () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#35 0x00007ffff670a5a1 in wxOnAssert(char const*, int, char const*, char const*, wchar_t const*) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#36 0x00007fffd3a699a4 in moveItemWithMouseCursor (aPanel=0xa50480, aDC=0x7fffffffd230, aPosition=..., aErase=true) at /home/user/repos/kicad.bzr/eeschema/schedit.cpp:660
#37 0x00007fffd3b42140 in EDA_DRAW_PANEL::CallMouseCapture (this=0xa50480, aDC=0x7fffffffd230, aPosition=..., aErase=true) at /home/user/repos/kicad.bzr/common/draw_panel.cpp:1536
#38 0x00007fffd3b3980e in EDA_DRAW_FRAME::RefreshCrossHair (this=0xa45300, aOldPos=..., aEvtPos=..., aDC=0x7fffffffd230) at /home/user/repos/kicad.bzr/common/draw_frame.cpp:1191
#39 0x00007fffd38fe755 in SCH_EDIT_FRAME::GeneralControl (this=0xa45300, aDC=0x7fffffffd230, aPosition=..., aHotKey=0) at /home/user/repos/kicad.bzr/eeschema/controle.cpp:235
#40 0x00007fffd3b40f3f in EDA_DRAW_PANEL::OnMouseEvent (this=0xa50480, event=...) at /home/user/repos/kicad.bzr/common/draw_panel.cpp:1242
#41 0x00007ffff670871e in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#42 0x00007ffff68a3f08 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#43 0x00007ffff68a400b in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#44 0x00007ffff68a43b8 in wxEvtHandler::TryHereOnly(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#45 0x00007ffff68a4443 in wxEvtHandler::ProcessEventLocally(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#46 0x00007ffff68a44a5 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#47 0x00007ffff708b32b in wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#48 0x00007ffff68a4217 in wxEvtHandler::SafelyProcessEvent(wxEvent&) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#49 0x00007ffff6e06d43 in ?? () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#50 0x00007ffff5376d1f in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#51 0x00007ffff4d4c2d5 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#52 0x00007ffff4d5e03c in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#53 0x00007ffff4d661a5 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#54 0x00007ffff4d668ff in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#55 0x00007ffff548e61c in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#56 0x00007ffff5375464 in gtk_propagate_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#57 0x00007ffff53758fb in gtk_main_do_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#58 0x00007ffff4fe8bac in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#59 0x00007ffff4606c3d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#60 0x00007ffff4606f20 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#61 0x00007ffff4607242 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#62 0x00007ffff5374857 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#63 0x00007ffff6dd9745 in wxGUIEventLoop::DoRun() () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#64 0x00007ffff674e750 in wxEventLoopBase::Run() () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#65 0x00007ffff670aa46 in wxAppConsoleBase::MainLoop() () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#66 0x00000000004407a9 in APP_KICAD::OnRun (this=0x7707f0) at /home/user/repos/kicad.bzr/kicad/kicad.cpp:274
#67 0x00007ffff67a5660 in wxEntry(int&, wchar_t**) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#68 0x000000000043e986 in main (argc=1, argv=0x7fffffffdf28) at /home/user/repos/kicad.bzr/kicad/kicad.cpp:306

Revision history for this message
Ben Kempke (bpkempke) wrote :
tags: added: eeschema
Ben Kempke (bpkempke)
description: updated
tags: added: assert
Revision history for this message
Nick Østergaard (nickoe) wrote :

I can't reproduce a crash in:
Application: kicad
Version: (2015-07-17 BZR 5958)-kicad release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1008,GCC 5.1.0,wx containers,compatible with 2.8)
Platform: Linux 4.1.2-2-ARCH x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.58.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Revision history for this message
Nick Østergaard (nickoe) wrote :

I can reproduce the assert with a debug build:
/home/nickoe/kicad_new/eeschema/schedit.cpp(660): assert "(item != __null)" failed in moveItemWithMouseCursor(): Cannot move invalid schematic item.

If I click fairly fast it wont really place the label. It will just toggle between being there and not.

Application: eeschema
Version: (2015-07-22 BZR 5978)-product debug build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1008,GCC 5.1.0,wx containers,compatible with 2.8)
Platform: Linux 4.1.2-2-ARCH x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.58.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=OFF
         KICAD_SCRIPTING_MODULES=OFF
         KICAD_SCRIPTING_WXPYTHON=OFF
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Ben Kempke (bpkempke)
summary: - eeschema: Assertion failure leads to crash placing imported hierarchical
- pin
+ eeschema: Assertion failure placing imported hierarchical pin
summary: - eeschema: Assertion failure placing imported hierarchical pin
+ eeschema: Assertion failure and undesired behavior placing imported
+ hierarchical pin
description: updated
Revision history for this message
Ben Kempke (bpkempke) wrote :

Confirmed. I've updated the description slightly to reflect the undesired behavior and lack of crash (I've been unable to reproduce the crash using the latest build).

Revision history for this message
Ben Kempke (bpkempke) wrote :

The problem appears to be caused by an inadvertent block move cancellation in draw_panel.cpp(1383):

    // End of block command on a double click
    // To avoid an unwanted block move command if the mouse is moved while double clicking
    if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
    {
        if( !screen->IsBlockActive() && IsMouseCaptured() )
        {
            m_endMouseCaptureCallback( this, &DC );
        }
    }

The expression evaluates to true when placing the hierarchical pin with a double click (even though this isn't a block operation).

Removal of this section of code clears the issue. I cannot recreate any situations which require this code during block operations, but it is possible that this isn't the case on other platforms.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1477213] Re: eeschema: Assertion failure and undesired behavior placing imported hierarchical pin

Removing this shouldn't effect block operations but I'm pretty sure it
will effect non-block double click left mouse button operations such as
end draw poly line. I'm not sure why a block operation is being
generated while the mouse is captured but I never could follow the logic
(or lack there of) of EDA_DRAW_PANEL::OnMouseEvent(). This function
suffers from what Linus called "function growth hormone imbalance
syndrome". It really needs to be broken into smaller more manageable
pieces using the appropriate mouse event handlers (EVT_LEFT_DOWN,
EVT_LEFT_UP, EVT_LEFT_DCLICK, etc.) rather than trying to handle every
mouse event in one giant event handler function. I've moved some of the
pieces into EVT_MOUSE_WHEEL but new code was being added to
EDA_DRAW_PANEL::OnMouseEvent() so I gave up.

On 7/23/2015 11:35 AM, Ben Kempke wrote:
> The problem appears to be caused by an inadvertent block move
> cancellation in draw_panel.cpp(1383):
>
> // End of block command on a double click
> // To avoid an unwanted block move command if the mouse is moved while double clicking
> if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
> {
> if( !screen->IsBlockActive() && IsMouseCaptured() )
> {
> m_endMouseCaptureCallback( this, &DC );
> }
> }
>
> The expression evaluates to true when placing the hierarchical pin with
> a double click (even though this isn't a block operation).
>
> Removal of this section of code clears the issue. I cannot recreate any
> situations which require this code during block operations, but it is
> possible that this isn't the case on other platforms.
>

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