pcbnew crash on exit (lp:#1831560)

[Original report](https://bugs.launchpad.net/bugs/1831560) created by **Andrew Lutsenko (qu1ck)**
```
Pcbnew crashes consistently when I perform these steps:

* Open board with some footprints.
* Run any action plugin even empty one. I'm not sure this is related to
plugins but the crash doesn't happen if I just make some other change in
the board.
* Close pcbnew and click "Save" or "Discard changes"
* Get SIGSEGV

Full version info and stacktrace with debug symbols:

Application: Pcbnew
Version: (5.1.0-856-g1721cc170), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.60.0 OpenSSL/1.0.2r zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.1
(+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Platform: Linux 4.19.37-2modified-amd64 x86_64, 64 bit, Little endian,
wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.62.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.60.0
    Compiler: GCC 7.3.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    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


#0  0x00007fffcfc152c2 in NETINFO_ITEM::GetNet() const (this=0x0) at
/src/kicad/pcbnew/./netinfo.h:226
#1  0x00007fffcfc9ff88 in BOARD_CONNECTED_ITEM::GetNetCode() const
(this=0x55555bc5f2b0) at /src/kicad/pcbnew/./board_connected_item.h:106
#2  0x00007fffd034e32e in BOARD::GetNodesCount(int) (this=0x55555bc9b000,
aNet=-1) at /src/kicad/pcbnew/class_board.cpp:753
#3  0x00007fffd034f052 in BOARD::GetMsgPanelInfo(EDA_UNITS_T,
std::vector<MSG_PANEL_ITEM, std::allocator<MSG_PANEL_ITEM> >&)
(this=0x55555bc9b000, aUnits=MILLIMETRES, aList=std::vector of length 3,
capacity 4 = {...}) at /src/kicad/pcbnew/class_board.cpp:868
#4  0x00007fffd04ceaaf in EDA_DRAW_FRAME::SetMsgPanel(EDA_ITEM*)
(this=0x55555738e5d0, aItem=0x55555bc9b000) at
/src/kicad/common/legacy_gal/eda_draw_frame.cpp:582
#5  0x00007fffcff7daf3 in PCB_EDITOR_CONTROL::ClearHighlight(TOOL_EVENT
const&) (this=0x555558a4c400, aEvent=...) at
/src/kicad/pcbnew/tools/pcb_editor_control.cpp:1194
#6  0x00007fffcff89706 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=@0x5555577e42f0: (int
(PCB_EDITOR_CONTROL::*)(PCB_EDITOR_CONTROL * const, const TOOL_EVENT &))
0x7fffcff7da36 <PCB_EDITOR_CONTROL::ClearHighlight(TOOL_EVENT const&)>,
__t=@0x5555577e4300: 0x555558a4c400, __args#0=...) at
/usr/include/c++/7/bits/invoke.h:73
#7  0x00007fffcff89391 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=@0x5555577e42f0: (int
(PCB_EDITOR_CONTROL::*)(PCB_EDITOR_CONTROL * const, const TOOL_EVENT &))
0x7fffcff7da36 <PCB_EDITOR_CONTROL::ClearHighlight(TOOL_EVENT const&)>,
__args#0=@0x5555577e4300: 0x555558a4c400, __args#1=...) at
/usr/include/c++/7/bits/invoke.h:96
#8  0x00007fffcff88a5d 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=0x5555577e42f0, __args=...) at /usr/include/c++/7/functional:469
#9  0x00007fffcff87f85 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=0x5555577e42f0, __args#0=...) at
/usr/include/c++/7/functional:551
#10 0x00007fffcff876d3 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++/7/bits/std_function.h:302
#11 0x00007fffd061c527 in std::function<int (TOOL_EVENT
const&)>::operator()(TOOL_EVENT const&) const (this=0x555557a00e18,
__args#0=...) at /usr/include/c++/7/bits/std_function.h:706
#12 0x00007fffd06196b0 in COROUTINE<int, TOOL_EVENT
const&>::callerStub(long) (aData=93825097022128) at
/src/kicad/include/tool/coroutine.h:331
#13 0x00007fffd0676e01 in make_fcontext () at /usr/local/bin/_pcbnew.kiface
#14 0x0000007b00000050 in  ()
#15 0x0000007000000073 in  ()
#16 0x0000006300000061 in  ()
#17 0x0000000000030f61 in  ()
#18 0x00007ffff37e5308 in main_arena () at /lib/x86_64-linux-gnu/libc.so.6
#19 0x00007ffff37e5308 in main_arena () at /lib/x86_64-linux-gnu/libc.so.6
#20 0x0000555557d286c0 in  ()
#21 0x0000555557d286c0 in  ()
#22 0x000000730000007b in  ()
#23 0x0000006100000070 in  ()
#24 0x0000006500000063 in  ()
#25 0x000000720000007d in  ()
#26 0x000000770000006f in  ()
#27 0x000000730000007b in  ()
#28 0x0000006100000070 in  ()
#29 0x0000006500000063 in  ()
#30 0x000000730000007d in  ()
#31 0x0000006100000070 in  ()
#32 0x0000006900000063 in  ()
#33 0x000000670000006e in  ()
#34 0x000000730000007b in  ()
#35 0x0000006100000070 in  ()
#36 0x0000006500000063 in  ()
#37 0x000000310000007d in  ()
#38 0x0000002e00000036 in  ()
#39 0x0000003100000035 in  ()
#40 0x000000730000007b in  ()
#41 0x0000006100000070 in  ()
#42 0x0000006500000063 in  ()
#43 0x0000006d0000007d in  ()
#44 0x0000000000000210 in  ()
#45 0x0000000000000050 in  ()
#46 0x000055555767e190 in  ()
#47 0x00007ffff37e4b58 in main_arena () at /lib/x86_64-linux-gnu/libc.so.6
#48 0x0000000000000000 in  ()
```
Original tags: pcbnew

Story points: 6.0