Segfault launching freshly built KiCad without pre-existing configuration folder
Description
I built KiCad from source (fresh git checkout) on Linux and get a segfault when trying to launch the kicad executable directly from the build directory, but only if the configuration folder does not exist yet. When the ~/.config/kicad folder and its content is present (created by an older nightly build) everything works as expected.
It's been a while since I built KiCad myself for the last time, so this might be a pebcak. But a segfault seemed scary enough to me to report it anyways (and should probably never happen, even in case of a broken build configuration).
#0 0x000000000058d1d4 in SETTINGS_MANAGER::GetCommonSettings() const (this=0x0)
at /home/aimylios/KiCad/kicad/include/settings/settings_manager.h:169
#1 0x0000000000589d8d in PGM_BASE::GetCommonSettings() const (this=0xc3e040 <program>)
at /home/aimylios/KiCad/kicad/common/pgm_base.cpp:586
#2 0x00000000004f18d1 in BITMAP_STORE::ThemeChanged() (this=0x14ea350) at /home/aimylios/KiCad/kicad/common/bitmap_store.cpp:169
#3 0x00000000004f136e in BITMAP_STORE::BITMAP_STORE() (this=0x14ea350) at /home/aimylios/KiCad/kicad/common/bitmap_store.cpp:110
#4 0x00000000004edbc2 in std::make_unique<BITMAP_STORE>() () at /usr/include/c++/10/bits/unique_ptr.h:962
#5 0x00000000004da653 in GetBitmapStore() () at /home/aimylios/KiCad/kicad/common/bitmap.cpp:98
#6 0x00000000004da705 in KiBitmap(BITMAPS) (aBitmap=BITMAPS::small_folder) at /home/aimylios/KiCad/kicad/common/bitmap.cpp:107
#7 0x0000000000685444 in DIALOG_MIGRATE_SETTINGS::DIALOG_MIGRATE_SETTINGS(SETTINGS_MANAGER*) (this=0x7fffffffab70, aManager=0x101aeb0)
at /home/aimylios/KiCad/kicad/common/dialogs/dialog_migrate_settings.cpp:33
#8 0x0000000000624276 in SETTINGS_MANAGER::MigrateIfNeeded() (this=0x101aeb0)
at /home/aimylios/KiCad/kicad/common/settings/settings_manager.cpp:464
#9 0x000000000062160a in SETTINGS_MANAGER::SETTINGS_MANAGER(bool) (this=0x101aeb0, aHeadless=false)
at /home/aimylios/KiCad/kicad/common/settings/settings_manager.cpp:61
#10 0x000000000058d4c3 in std::make_unique<SETTINGS_MANAGER>() () at /usr/include/c++/10/bits/unique_ptr.h:962
#11 0x0000000000586b0c in PGM_BASE::InitPgm() (this=0xc3e040 <program>) at /home/aimylios/KiCad/kicad/common/pgm_base.cpp:277
#12 0x000000000047fee7 in PGM_KICAD::OnPgmInit() (this=0xc3e040 <program>) at /home/aimylios/KiCad/kicad/kicad/kicad.cpp:105
#13 0x0000000000482648 in APP_KICAD::OnInit() (this=0xcb97a0) at /home/aimylios/KiCad/kicad/kicad/kicad.cpp:312
#14 0x0000000000481d8d in wxAppConsoleBase::CallOnInit() (this=0xcb97a0) at /usr/include/wx-3.0/wx/app.h:93
#15 0x00007ffff74d74c2 in wxEntry(int&, wchar_t**) () at /lib64/libwx_baseu-3.0.so.0
#16 0x0000000000480e69 in main(int, char**) (argc=1, argv=0x7fffffffe0d8) at /home/aimylios/KiCad/kicad/kicad/kicad.cpp:383
Steps to reproduce
- Delete or rename the .config/kicad/ directory (on Linux) if it exists.
- Build KiCad and then launch the kicad executable from the build dir.
- Observe segfault.
KiCad Version
Application: KiCad
Version: (5.99.0-9764-g52ea9bb75f-dirty), debug build
Libraries:
wxWidgets 3.0.5
libcurl/7.71.1 OpenSSL/1.1.1j-fips zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.1 (+libidn2/2.3.0) libssh/0.9.5/openssl/zlib nghttp2/1.43.0
Platform: Linux 5.10.21-200.fc33.x86_64 x86_64, 64 bit, Little endian, wxGTK, KDE, x11
Build Info:
Date: Mar 13 2021 14:43:02
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.73.0
Curl: 7.71.1
Compiler: GCC 10.2.1 with C++ ABI 1014
Build settings:
KICAD_SCRIPTING=OFF
KICAD_SCRIPTING_MODULES=OFF
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=OFF
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=OFF
KICAD_SPICE=OFF
KICAD_STDLIB_DEBUG=OFF
KICAD_STDLIB_LIGHT_DEBUG=OFF
KICAD_SANITIZE=OFF