KiCAD Crach on simulating after a change of project (lp:#1753092)

[Original report](https://bugs.launchpad.net/bugs/1753092) created by **Julien Faucher (suzizecat)**
```
Hi all.

I ran across a full KiCAD crash bug.

With a project A, open the simulator try a simulation.
Close the simulator and your design.
Open another project B through "Open Recent", launch a simulation. The
design must include some SPICE models located in another directory.
You will have some (false) errors because the simulator doesn't seems to
find the libs (but that's another bug).

Dismiss all pop-ups.
Click on "Launch Simulation"
Dismiss all pop-ups again.
The last pop-up will crash KiCAD.

When i write "try a simulation" or "launch it", I mean set it up and launch
the simulation (in my case, transient simulations) as it's mean to be used.

I'll join my working directory (with the two projects)
Project A is "slowactivator" and project B is "phase"

You will find the .libs files in "spice".

You should replace the paths in my design by the path which should work for
you.

Enjoy !
Julien FAUCHER


I produced a back-trace :

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff55bff5d in __GI_abort () at abort.c:90
#2  0x00007ffff560828d in __libc_message (action=action@entry=do_abort,
    fmt=fmt@entry=0x7ffff572f528 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff560f64a in malloc_printerr (action=<optimized out>,
    str=0x7ffff572f8b0 "double free or corruption (out)", ptr=<optimized
out>,
    ar_ptr=<optimized out>) at malloc.c:5426
#4  0x00007ffff561173e in _int_free (av=0x7ffff5961c20 <main_arena>,
    p=<optimized out>, have_lock=0) at malloc.c:4175
#5  0x00007ffff561644e in __GI___libc_free (mem=<optimized out>)
    at malloc.c:3145
#6  0x00007fffe16ffaca in ?? () from /usr/bin/_eeschema.kiface
#7  0x00007fffe15d5698 in ?? () from /usr/bin/_eeschema.kiface
#8  0x00007fffe04d66aa in ?? () from /usr/lib/x86_64-linux-
gnu/libngspice.so.0
#9  0x00007fffe04d6a42 in ?? () from /usr/lib/x86_64-linux-
gnu/libngspice.so.0
#10 0x00007fffe04d77a6 in ?? () from /usr/lib/x86_64-linux-
gnu/libngspice.so.0
#11 0x00007fffe096454f in ?? () from /usr/lib/x86_64-linux-
gnu/libngspice.so.0
#12 0x00007fffe051b864 in ?? () from /usr/lib/x86_64-linux-
gnu/libngspice.so.0
#13 0x00007fffe04f5387 in ?? () from /usr/lib/x86_64-linux-
gnu/libngspice.so.0
#14 0x00007fffe04f6e97 in ?? () from /usr/lib/x86_64-linux-
gnu/libngspice.so.0
#15 0x00007fffe04d6402 in ngSpice_Circ ()
   from /usr/lib/x86_64-linux-gnu/libngspice.so.0
#16 0x00007fffe15d6a10 in ?? () from /usr/bin/_eeschema.kiface
#17 0x00007fffe15dc2da in ?? () from /usr/bin/_eeschema.kiface
#18 0x00007ffff69bb7ee in
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0

And I'm under :

Application: kicad
Version: 5.0.0-rc2-dev-unknown-d5ac7c0~62~ubuntu17.10.1, release build
Libraries:
    wxWidgets 3.0.3
    libcurl/7.55.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/2.0.2 libpsl/0.18.0
(+libidn2/2.0.2) librtmp/2.3
Platform: Linux 4.13.0-36-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    Curl: 7.55.1
    Compiler: GCC 7.2.0 with C++ ABI 1011

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_SPICE=ON
```

Story points: 6.0