Comment 2 for bug 1831560

Revision history for this message
Ian McInerney (imcinerney) wrote :

@Seth. I can reproduce this on the pic programmer demo project using these steps and the Python plugin attached (locate it inside ~/.kicad_plugins):

1) Open pcbnew
2) Run the Python action plugin "AAAAAAAA"
3) Close pcbnew (discard changes if any)
Crash

The error is:
0x00007fffe055e41c in NETINFO_ITEM::GetNet (this=0x0) at /home/imcinerney/Documents/kicadDev/kicad-master/pcbnew/./netinfo.h:226
226 int GetNet() const { return m_NetCode; }

The backtrace I receive is:

#0 0x00007fffe055e41c in NETINFO_ITEM::GetNet() const (this=0x0) at /home/imcinerney/Documents/kicadDev/kicad-master/pcbnew/./netinfo.h:226
#1 0x00007fffe05e6346 in BOARD_CONNECTED_ITEM::GetNetCode() const (this=0x51b41e0) at /home/imcinerney/Documents/kicadDev/kicad-master/pcbnew/./board_connected_item.h:106
#2 0x00007fffe0c7f192 in BOARD::GetNodesCount(int) (this=0x5726f90, aNet=-1) at /home/imcinerney/Documents/kicadDev/kicad-master/pcbnew/class_board.cpp:753
#3 0x00007fffe0c7fddf in BOARD::GetMsgPanelInfo(EDA_UNITS_T, std::vector<MSG_PANEL_ITEM, std::allocator<MSG_PANEL_ITEM> >&) (this=0x5726f90, aUnits=INCHES, aList=std::vector of length 3, capacity 4 = {...})
    at /home/imcinerney/Documents/kicadDev/kicad-master/pcbnew/class_board.cpp:864
#4 0x00007fffe0dfd8c7 in EDA_DRAW_FRAME::SetMsgPanel(EDA_ITEM*) (this=0x246b3e0, aItem=0x5726f90) at /home/imcinerney/Documents/kicadDev/kicad-master/common/legacy_gal/eda_draw_frame.cpp:582
#5 0x00007fffe08b8473 in PCB_EDITOR_CONTROL::ClearHighlight(TOOL_EVENT const&) (this=0x516dc10, aEvent=...) at /home/imcinerney/Documents/kicadDev/kicad-master/pcbnew/tools/pcb_editor_control.cpp:1148
#6 0x00007fffe08c3454 in std::__invoke_impl<int, int (PCB_EDITOR_CONTROL::*&)(TOOL_EVENT const&), PCB_EDITOR_CONTROL*&, TOOL_EVENT const&>(std::__invoke_memfun_deref, int (PCB_EDITOR_CONTROL::*&)(TOOL_EVENT const&), PCB_EDITOR_CONTROL*&, TOOL_EVENT const&) (__f=@0x4e0de70: (int (PCB_EDITOR_CONTROL::*)(PCB_EDITOR_CONTROL * const, const TOOL_EVENT &)) 0x7fffe08b83b6 <PCB_EDITOR_CONTROL::ClearHighlight(TOOL_EVENT const&)>, __t=@0x4e0de80: 0x516dc10, __args#0=...)
    at /usr/include/c++/8/bits/invoke.h:73
#7 0x00007fffe08c30eb in std::__invoke<int (PCB_EDITOR_CONTROL::*&)(TOOL_EVENT const&), PCB_EDITOR_CONTROL*&, TOOL_EVENT const&>(int (PCB_EDITOR_CONTROL::*&)(TOOL_EVENT const&), PCB_EDITOR_CONTROL*&, TOOL_EVENT const&) (__fn=
    @0x4e0de70: (int (PCB_EDITOR_CONTROL::*)(PCB_EDITOR_CONTROL * const, const TOOL_EVENT &)) 0x7fffe08b83b6 <PCB_EDITOR_CONTROL::ClearHighlight(TOOL_EVENT const&)>, __args#0=@0x4e0de80: 0x516dc10, __args#1=...)
    at /usr/include/c++/8/bits/invoke.h:95
#8 0x00007fffe08c2781 in std::_Bind<int (PCB_EDITOR_CONTROL::*(PCB_EDITOR_CONTROL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::__call<int, TOOL_EVENT const&, 0ul, 1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>) (this=0x4e0de70, __args=...) at /usr/include/c++/8/functional:400
#9 0x00007fffe08c1d63 in std::_Bind<int (PCB_EDITOR_CONTROL::*(PCB_EDITOR_CONTROL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT const&) (this=0x4e0de70, __args#0=...)
    at /usr/include/c++/8/functional:484
#10 0x00007fffe08c14f9 in std::_Function_handler<int (TOOL_EVENT const&), std::_Bind<int (PCB_EDITOR_CONTROL::*(PCB_EDITOR_CONTROL*, std::_Placeholder<1>))(TOOL_EVENT const&)> >::_M_invoke(std::_Any_data const&, TOOL_EVENT const&) (__functor=..., __args#0=...) at /usr/include/c++/8/bits/std_function.h:282
#11 0x00007fffe0f45a39 in std::function<int (TOOL_EVENT const&)>::operator()(TOOL_EVENT const&) const (this=0x53d8ff8, __args#0=...) at /usr/include/c++/8/bits/std_function.h:687
#12 0x00007fffe0f42bfa in COROUTINE<int, TOOL_EVENT const&>::callerStub(long) (aData=90083632) at /home/imcinerney/Documents/kicadDev/kicad-master/include/tool/coroutine.h:331
#13 0x00007fffe0f9f021 in make_fcontext () at /usr/local/bin/_pcbnew.kiface
#14 0x00c2c200c2c200c2 in ()
#15 0x0000000000000000 in ()

The problem seems to be caused by trying to redraw the message box, and it is running into a null pointer in a m_netinfo object inside a pad when counting the nodes.

Application: Pcbnew
Version: (5.1.0-844-g7e1407f20), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.59.0 OpenSSL/1.1.0i zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) libssh/0.8.6/openssl/zlib nghttp2/1.32.1
Platform: Linux 5.0.16-100.fc28.x86_64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
    Boost: 1.66.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.59.0
    Compiler: GCC 8.3.1 with C++ ABI 1013

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