Pcbnew crashes when importing footprint: segfault at BOARD::ReplaceNetlist (lp:#1795288)

[Original report](https://bugs.launchpad.net/bugs/1795288) created by **Paul Hansel (paulhansel)**
```
Occurs when reading netlist. Have not recompiled to absolute latest
version, but will report back once that is done.

SYSTEM:
Application: pcbnew
Version: (6.0.0-rc1-dev-595-g282e37b), release build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Platform: Linux 4.15.0-34-generic 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.58.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.47.0
    Compiler: GCC 5.4.0 with C++ ABI 1009

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_USE_OCC=OFF
    KICAD_SPICE=ON


BACKTRACE:

(gdb) bt
#0  0x00007fffec99933a in BOARD::ReplaceNetlist(NETLIST&, bool,
std::vector<MODULE*, std::allocator<MODULE*> >*, REPORTER&) ()
   from /usr/local/bin/_pcbnew.kiface
#1  0x00007fffec5b03ea in PCB_EDIT_FRAME::ReadPcbNetlist(wxString const&,
wxString const&, REPORTER&, bool, bool, bool, bool, bool, bool) ()
   from /usr/local/bin/_pcbnew.kiface
#2  0x00007fffec38d23c in DIALOG_NETLIST::loadNetlist(bool) ()
   from /usr/local/bin/_pcbnew.kiface
#3  0x00007fffec38dff8 in DIALOG_NETLIST::OnUpdatePCB(wxCommandEvent&) ()
   from /usr/local/bin/_pcbnew.kiface
#4  0x00007ffff696b1fe in wxAppConsoleBase::CallEventHandler(wxEvtHandler*,
wxEventFunctor&, wxEvent&) const ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#5  0x00007ffff6af16e7 in
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#6  0x00007ffff6af1ace in wxEvtHandler::SearchDynamicEventTable(wxEvent&)
()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7  0x00007ffff6af1b5f in wxEvtHandler::TryHereOnly(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#8  0x00007ffff6af1c13 in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#9  0x00007ffff6af1c75 in wxEvtHandler::ProcessEvent(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x00007ffff6af19e7 in wxEvtHandler::SafelyProcessEvent(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x00007ffff72c5b57 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#12 0x00007ffff4f401d4 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007ffff4f5a9a6 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007ffff4f5b08f in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff54c4f35 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#16 0x00007ffff4f401d4 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007ffff4f5a9a6 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#18 0x00007ffff4f5b08f in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007ffff54c3e79 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#20 0x00007ffff556aaec in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#21 0x00007ffff4f3feff in g_closure_invoke ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007ffff4f5256e in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007ffff4f5a7f9 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff4f5b08f in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007ffff568293c in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#26 0x00007ffff5569284 in gtk_propagate_event ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#27 0x00007ffff556963b in gtk_main_do_event ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#28 0x00007ffff51ddc8c in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#29 0x00007ffff42da197 in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007ffff42da3f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007ffff42da712 in g_main_loop_run ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ffff5568697 in gtk_main ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#33 0x00007ffff724fed5 in wxGUIEventLoop::DoRun() ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#34 0x00007ffff69ad353 in wxEventLoopBase::Run() ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#35 0x00007ffff72d2cdd in wxDialog::ShowModal() ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#36 0x00007fffec38f919 in PCB_EDIT_FRAME::InstallNetlistFrame(wxDC*) ()
   from /usr/local/bin/_pcbnew.kiface
#37 0x00007fffec531ffd in
PCB_EDIT_FRAME::Process_Special_Functions(wxCommandEvent&) () from
/usr/local/bin/_pcbnew.kiface
#38 0x00007ffff696b1fe in wxAppConsoleBase::CallEventHandler(wxEvtHandler*,
wxEventFunctor&, wxEvent&) const ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#39 0x00007ffff6af16e7 in
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#40 0x00007ffff6af17db in wxEventHashTable::HandleEvent(wxEvent&,
wxEvtHandler*) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#41 0x00007ffff6af1b8b in wxEvtHandler::TryHereOnly(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#42 0x00007fffecbe886b in EDA_BASE_FRAME::ProcessEvent(wxEvent&) ()
   from /usr/local/bin/_pcbnew.kiface
#43 0x00007ffff6af1993 in wxEvtHandler::DoTryChain(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#44 0x00007ffff6af1c75 in wxEvtHandler::ProcessEvent(wxEvent&) ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#45 0x00007ffff7464de8 in wxWindowBase::TryAfter(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#46 0x00007ffff6af19e7 in wxEvtHandler::SafelyProcessEvent(wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#47 0x00007ffff7409bff in wxMenuBase::SendEvent(int, int) ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#48 0x00007ffff72ed0eb in ?? ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#49 0x00007ffff4f3ffa5 in g_closure_invoke ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#50 0x00007ffff4f51fc1 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#51 0x00007ffff4f5ad5c in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#52 0x00007ffff4f5b08f in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#53 0x00007ffff56816ee in gtk_widget_activate ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#54 0x00007ffff557c8dd in gtk_menu_shell_activate_item ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#55 0x00007ffff557cc46 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#56 0x00007ffff556aaec in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#57 0x00007ffff4f3ffa5 in g_closure_invoke ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#58 0x00007ffff4f5256e in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#59 0x00007ffff4f5a7f9 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#60 0x00007ffff4f5b08f in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#61 0x00007ffff568293c in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#62 0x00007ffff5569284 in gtk_propagate_event ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#63 0x00007ffff556963b in gtk_main_do_event ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#64 0x00007ffff51ddc8c in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#65 0x00007ffff42da197 in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#66 0x00007ffff42da3f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#67 0x00007ffff42da712 in g_main_loop_run ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#68 0x00007ffff5568697 in gtk_main ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#69 0x00007ffff724fed5 in wxGUIEventLoop::DoRun() ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#70 0x00007ffff69ad353 in wxEventLoopBase::Run() ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#71 0x00007ffff6972666 in wxAppConsoleBase::MainLoop() ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#72 0x000000000041f2b9 in ?? ()
#73 0x00007ffff69fef70 in wxEntry(int&, wchar_t**) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#74 0x00000000004185a8 in ?? ()
#75 0x00007ffff5aa3830 in __libc_start_main (
    main=<error reading variable: Cannot access memory at address
0x7fffffffde08>,
    argc=<error reading variable: Cannot access memory at address
0x7fffffffde04>,
    argv=<error reading variable: Cannot access memory at address
0x7fffffffddf8>,
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=<error reading variable: Cannot access memory at address
0x7fffffffdeb0>) at ../csu/libc-start.c:291
#76 0x000000000041acf9 in _start ()
```
Original tags: pcbnew

Story points: 6.0