Kicad segfault on missing color scheme
Description
I was playing around with color scheme in connection with #5030 (closed), which resulted in a segfault.
WX Backtrace:
ASSERT INFO:
../src/common/ctrlsub.cpp(231): assert "IsValid(n)" failed in GetClientData(): Invalid index passed to GetClientData()
BACKTRACE:
[1] wxItemContainer::GetClientData(unsigned int) const
[2] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[3] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[4] wxEvtHandler::TryHereOnly(wxEvent&)
[5] wxEvtHandler::DoTryChain(wxEvent&)
[6] wxEvtHandler::ProcessEvent(wxEvent&)
[7] wxWindowBase::TryAfter(wxEvent&)
[8] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[9] wxMenuBase::SendEvent(int, int)
[10] g_closure_invoke
[11] g_signal_emit_valist
[12] g_signal_emit
[13] gtk_widget_activate
[14] gtk_menu_shell_activate_item
[15] g_signal_emit_valist
[16] g_signal_emit
[17] gtk_main_do_event
[18] g_main_context_dispatch
[19] g_main_loop_run
[20] gtk_main
[21] wxGUIEventLoop::DoRun()
[22] wxEventLoopBase::Run()
[23] wxAppConsoleBase::MainLoop()
[24] APP_KICAD::OnRun() /home/niki/Sync/Kicad/Software/kicad-master/kicad/kicad.cpp:279
[25] wxEntry(int&, wchar_t**)
[26] main /home/niki/Sync/Kicad/Software/kicad-master/kicad/kicad.cpp:312
[27] __libc_start_main
[28] _start
Steps to reproduce
- Create a new color scheme or use an existing none default one, and make it the default.
- Close Kicad.
- Go into ${HOME}/.config/kicad/colors and rename the currently set color scheme.
- Start Kicad and start eeschema.
- Try to open Preferences in the preferences menu, crash.
- Rename the color scheme file back to it's original file name.
- Start Kicad, Eeschema, try to go to the preferences and the window opens
KiCad Version
Marked dirty because of #5013
Application: KiCad
Version: (5.99.0-2499-g6e4d4401a-dirty), debug build
Libraries:
wxWidgets 3.0.4
libcurl/7.69.1 OpenSSL/1.1.1g-fips zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh/0.9.4/openssl/zlib nghttp2/1.41.0
Platform: Linux 5.7.10-201.fc32.x86_64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
Date: Jul 31 2020 16:00:57
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.69.0
OCC: 7.4.0
Curl: 7.69.1
ngspice: 32
Compiler: GCC 10.2.1 with C++ ABI 1014
Build settings:
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_OCC=ON
KICAD_SPICE=ON
KICAD_STDLIB_DEBUG=OFF
KICAD_STDLIB_LIGHT_DEBUG=OFF
KICAD_SANITIZE=OFF