pcbnew segfaults (lp:#1794571)

[Original report](https://bugs.launchpad.net/bugs/1794571) created by **Matthias Urlichs (smurf)**
```
Version 5.0.1, head

$ gdb pcbnew
(gdb) r /mnt/store/physical/kicad/thermo/thermo.brd
19:00:35: Debug: Loading project
'/mnt/store/physical/kicad/thermo/thermo.pro' settings.

Thread 1 "pcbnew" received signal SIGSEGV, Segmentation fault.
0x00007fffe65dab93 in ?? () from /usr/bin/_pcbnew.kiface
(gdb) whe
#0  0x00007fffe65dab93 in  () at /usr/bin/_pcbnew.kiface
#1  0x00007fffe65d55cc in  () at /usr/bin/_pcbnew.kiface
#2  0x00007fffe65dd10d in  () at /usr/bin/_pcbnew.kiface
#3  0x00007fffe6580f13 in  () at /usr/bin/_pcbnew.kiface
#4  0x00007fffe6603809 in  () at /usr/bin/_pcbnew.kiface
#5  0x00007fffe6611b17 in  () at /usr/bin/_pcbnew.kiface
#6  0x00007fffe6611e34 in  () at /usr/bin/_pcbnew.kiface
#7  0x00007fffe6161bde in  () at /usr/bin/_pcbnew.kiface
#8  0x0000555555589d50 in  ()
#9  0x000055555558cbc0 in  ()
#10 0x00007ffff6441f4a in wxEntry(int&, wchar_t**) ()
    at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x0000555555586be2 in  ()
#12 0x00007ffff3cb7a87 in __libc_start_main (main=
    0x555555586bd0, argc=2, argv=0x7fffffffe0f8, init=<optimized out>,
fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe0e8)
at ../csu/libc-start.c:310
#13 0x00005555555890da in _start ()
(gdb) thr 2
[Switching to thread 2 (Thread 0x7fffe4368700 (LWP 43816))]
#0  0x00007ffff3d825d9 in __GI___poll (fds=0x555556f9ad50, nfds=2,
timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
29      ../sysdeps/unix/sysv/linux/poll.c: No such file or directory.
(gdb) whe
#0  0x00007ffff3d825d9 in __GI___poll (fds=0x555556f9ad50, nfds=2,
timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007ffff26da439 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff26da54c in g_main_context_iteration () at
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff26da591 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff2701e05 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff40575aa in start_thread (arg=0x7fffe4368700) at
pthread_create.c:463
#6  0x00007ffff3d8ccbf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) thr 3
[Switching to thread 3 (Thread 0x7fffe3b67700 (LWP 43817))]
#0  0x00007ffff3d825d9 in __GI___poll (fds=0x555556fac820, nfds=2,
timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
29      in ../sysdeps/unix/sysv/linux/poll.c
(gdb) whe
#0  0x00007ffff3d825d9 in __GI___poll (fds=0x555556fac820, nfds=2,
timeout=-1)
    at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007ffff26da439 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff26da7d2 in g_main_loop_run () at /usr/lib/x86_64-linux-
gnu/libglib-2.0.so.0
#3  0x00007fffedd5fe26 in  () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4  0x00007ffff2701e05 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff40575aa in start_thread (arg=0x7fffe3b67700) at
pthread_create.c:463
#6  0x00007ffff3d8ccbf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) thr 4
[Switching to thread 4 (Thread 0x7fffd3973700 (LWP 43818))]
#0  0x00007ffff405d4ec in futex_wait_cancelable (private=<optimized out>,
expected=0,
    futex_word=0x55555a0d1ad0) at ../sysdeps/unix/sysv/linux/futex-
internal.h:88
88      ../sysdeps/unix/sysv/linux/futex-internal.h: No such file or
directory.
(gdb) whe
#0  0x00007ffff405d4ec in futex_wait_cancelable (private=<optimized out>,
expected=0, futex_word=0x55555a0d1ad0) at ../sysdeps/unix/sysv/linux/futex-
internal.h:88
#1  0x00007ffff405d4ec in __pthread_cond_wait_common (abstime=0x0,
mutex=0x55555a0d1a80, cond=0x55555a0d1aa8) at pthread_cond_wait.c:502
#2  0x00007ffff405d4ec in __pthread_cond_wait (cond=0x55555a0d1aa8,
mutex=0x55555a0d1a80)
    at pthread_cond_wait.c:655
#3  0x00007fffe0d0fa8b in  () at /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#4  0x00007fffe0d0f7b7 in  () at /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#5  0x00007ffff40575aa in start_thread (arg=0x7fffd3973700) at
pthread_create.c:463
#6  0x00007ffff3d8ccbf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) thr 5
[Switching to thread 5 (Thread 0x7fffd3172700 (LWP 43819))]
#0  0x00007ffff405d4ec in futex_wait_cancelable (private=<optimized out>,
expected=0,
    futex_word=0x555558ba5470) at ../sysdeps/unix/sysv/linux/futex-
internal.h:88
88      in ../sysdeps/unix/sysv/linux/futex-internal.h
(gdb) whe
#0  0x00007ffff405d4ec in futex_wait_cancelable (private=<optimized out>,
expected=0, futex_word=0x555558ba5470) at ../sysdeps/unix/sysv/linux/futex-
internal.h:88
#1  0x00007ffff405d4ec in __pthread_cond_wait_common (abstime=0x0,
mutex=0x555558ba5420, cond=0x555558ba5448) at pthread_cond_wait.c:502
#2  0x00007ffff405d4ec in __pthread_cond_wait (cond=0x555558ba5448,
mutex=0x555558ba5420)
    at pthread_cond_wait.c:655
#3  0x00007fffe0d0fa8b in  () at /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#4  0x00007fffe0d0f7b7 in  () at /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#5  0x00007ffff40575aa in start_thread (arg=0x7fffd3172700) at
pthread_create.c:463
#6  0x00007ffff3d8ccbf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) thr 6
Unknown thread 6.
(gdb) thr 0
Invalid thread ID: 0
(gdb) thr 1
[Switching to thread 1 (Thread 0x7fffe98cb100 (LWP 43770))]
#0  0x00007fffe65dab93 in ?? () from /usr/bin/_pcbnew.kiface
(gdb)
```

Story points: 6.0