Kicad 5.1.2: Gerview segfaults almost immediately after start on Ubuntu (lp:#1829647)

[Original report](https://bugs.launchpad.net/bugs/1829647) created by **Marat (zhamaletdinov-marat)**
```
Ubuntu MATE 18.04 x86_64.
Gerbview always segfaults after start, the only window I've ever seen is
the one asking about enabling hardware acceleration. This dialog is not
responding.

Running it through GDB shows:
Thread 1 "gerbview" received signal SIGSEGV, Segmentation fault.
0x00007fffe1c49f50 in ?? () from /usr/bin/_gerbview.kiface
(gdb) bt
#0  0x00007fffe1c49f50 in ?? () from /usr/bin/_gerbview.kiface
#1  0x00007ffff678d4be in
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#2  0x00007ffff678d5c3 in wxEventHashTable::HandleEvent(wxEvent&,
wxEvtHandler*) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#3  0x00007ffff678d98b in wxEvtHandler::TryHereOnly(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#4  0x00007fffe1d0911b in ?? () from /usr/bin/_gerbview.kiface
#5  0x00007ffff678d783 in wxEvtHandler::DoTryChain(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#6  0x00007ffff678da75 in wxEvtHandler::ProcessEvent(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7  0x00007ffff7063d83 in wxMenuBase::UpdateUI(wxEvtHandler*) () from
/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#8  0x00007ffff706403a in wxMenuBarBase::UpdateMenus() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#9  0x00007ffff6ff8419 in wxFrameBase::OnInternalIdle() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#10 0x00007ffff70b1dc3 in wxWindowBase::SendIdleEvents(wxIdleEvent&) ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#11 0x00007ffff6f473df in wxFrame::SendIdleEvents(wxIdleEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#12 0x00007ffff6f8829d in wxAppBase::ProcessIdle() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#13 0x00007ffff6eb96c9 in wxApp::DoIdle() () from /usr/lib/x86_64-linux-
gnu/libwx_gtk3u_core-3.0.so.0
#14 0x00007ffff6eb97c3 in ?? () from /usr/lib/x86_64-linux-
gnu/libwx_gtk3u_core-3.0.so.0
#15 0x00007ffff3db0285 in g_main_context_dispatch () from
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff3db0650 in ?? () from /usr/lib/x86_64-linux-
gnu/libglib-2.0.so.0
#17 0x00007ffff3db0962 in g_main_loop_run () from /usr/lib/x86_64-linux-
gnu/libglib-2.0.so.0
#18 0x00007ffff4ef1db3 in gtk_dialog_run () from /usr/lib/x86_64-linux-
gnu/libgtk-3.so.0
#19 0x00007ffff6f58c93 in wxMessageDialog::ShowModal() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk3u_core-3.0.so.0
#20 0x00007fffe1c6a875 in ?? () from /usr/bin/_gerbview.kiface
#21 0x00007fffe1c282ca in ?? () from /usr/bin/_gerbview.kiface
#22 0x000055555559acab in ?? ()
#23 0x0000555555576bab in ?? ()

Kicad was installed through ppa:js-reynaud/kicad-5.1. Other applications in
Kicad work fine.

Version info:

Application: kicad
Version: 5.1.2-f72e74a~84~ubuntu18.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1
(+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.18.0-20-generic 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.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.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
```
Original tags: gerbview mate ubuntu

Story points: 10.0