pcb: segfault opening footprint properties with invalid paths
Description
After placing a footprint to edit the 3d model properties, got a popup showing "3D model search path: The given path does not exist ${KIPRJMOD}/../../3d" and then a segfault when you push ok on that button.
Steps to reproduce
- Create a new project, (to demonstrate a different bug, perchance)
- open pcb
- Setup an "invalid" 3d alias search path that attempts to use an environment variable eg
- place any footprint
- mouse over and press "e" to edit.
Making that 3d alias path absolute instead of relative avoids the segfault.
Stack trace
Thread 1 "kicad" received signal SIGSEGV, Segmentation fault.
0x00007fffca9b9124 in PANEL_FP_PROPERTIES_3D_MODEL::AdjustGridColumnWidths(int) () from /usr/lib/kicad-nightly/bin/_pcbnew.kiface
─── Breakpoints ────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Expressions ────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Source ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Stack ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x00007fffca9b9124
[1] from 0x00007fffca8ea0b1
[2] from 0x00007ffff759f26e
[3] from 0x00007ffff75a142a
[4] from 0x00007ffff75a14c0
[5] from 0x00007ffff75a157b
[6] from 0x00007ffff75a1661
[7] from 0x00007ffff7a9d563
[8] from 0x00007ffff7a99e83
[9] from 0x00007ffff7a99eb8
[+]
─── Threads ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[20] id 676671 name pool-kicad from 0x00007ffff5f9bedd
[3] id 676643 name gdbus from 0x00007ffff5f963ff
[2] id 676642 name gmain from 0x00007ffff5f963ff
[1] id 676638 name kicad from 0x00007fffca9b9124
─── Variables ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>>> y
Undefined command: "y". Try "help".
>>> bt
#0 0x00007fffca9b9124 in PANEL_FP_PROPERTIES_3D_MODEL::AdjustGridColumnWidths(int) () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#1 0x00007fffca8ea0b1 in DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI(wxUpdateUIEvent&) () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#2 0x00007ffff759f26e in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () at /lib64/libwx_baseu-3.0.so.0
#3 0x00007ffff75a142a in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () at /lib64/libwx_baseu-3.0.so.0
#4 0x00007ffff75a14c0 in wxEvtHandler::TryHereOnly(wxEvent&) () at /lib64/libwx_baseu-3.0.so.0
#5 0x00007ffff75a157b in wxEvtHandler::ProcessEventLocally(wxEvent&) () at /lib64/libwx_baseu-3.0.so.0
#6 0x00007ffff75a1661 in wxEvtHandler::ProcessEvent(wxEvent&) () at /lib64/libwx_baseu-3.0.so.0
#7 0x00007ffff7a9d563 in wxWindowBase::UpdateWindowUI(long) () at /lib64/libwx_gtk3u_core-3.0.so.0
#8 0x00007ffff7a99e83 in wxWindowBase::SendIdleEvents(wxIdleEvent&) () at /lib64/libwx_gtk3u_core-3.0.so.0
#9 0x00007ffff7a99eb8 in wxWindowBase::SendIdleEvents(wxIdleEvent&) () at /lib64/libwx_gtk3u_core-3.0.so.0
#10 0x00007ffff797098f in wxFrame::SendIdleEvents(wxIdleEvent&) () at /lib64/libwx_gtk3u_core-3.0.so.0
#11 0x00007ffff79abecd in wxAppBase::ProcessIdle() () at /lib64/libwx_gtk3u_core-3.0.so.0
#12 0x00007ffff7900245 in wxApp::DoIdle() () at /lib64/libwx_gtk3u_core-3.0.so.0
#13 0x00007ffff7900353 in wxapp_idle_callback () at /lib64/libwx_gtk3u_core-3.0.so.0
#14 0x00007ffff67f9b5b in g_idle_dispatch () at /lib64/libglib-2.0.so.0
#15 0x00007ffff67faa9f in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#16 0x00007ffff684ca98 in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
#17 0x00007ffff67fa163 in g_main_loop_run () at /lib64/libglib-2.0.so.0
#18 0x00007ffff6cb9017 in gtk_dialog_run () at /lib64/libgtk-3.so.0
#19 0x00007ffff798c397 in wxMessageDialog::ShowModal() () at /lib64/libwx_gtk3u_core-3.0.so.0
#20 0x00007ffff78f134c in wxMessageBox(wxString const&, wxString const&, long, wxWindow*, int, int) () at /lib64/libwx_gtk3u_core-3.0.so.0
#21 0x00007fffcb4e3e2d in FILENAME_RESOLVER::addPath(SEARCH_PATH const&) [clone .isra.0] () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#22 0x00007fffcb4e5ba3 in FILENAME_RESOLVER::createPathList() [clone .isra.0] () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#23 0x00007fffcb4b0e2a in PROJECT::Get3DCacheManager(bool) [clone .constprop.0] () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#24 0x00007fffcb4456ca in PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(PCB_BASE_EDIT_FRAME*, FOOTPRINT*, DIALOG_SHIM*, wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&) [clone .constprop.0] () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#25 0x00007fffcab09f62 in PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(FOOTPRINT*) () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#26 0x00007fffcabb8f0a in EDIT_TOOL::Properties(TOOL_EVENT const&) () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#27 0x00007fffcb1910a0 in COROUTINE<int, TOOL_EVENT const&>::callerStub(long) () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#28 0x00007fffcb519db1 in make_fcontext () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#29 0x0000007200000075 in ()
#30 0x0000006500000063 in ()
#31 0x0000002f00000073 in ()
#32 0x0000000000008d01 in ()
#33 0x000055555cb83940 in ()
#34 0x00007ffff60651b0 in main_arena () at /lib64/libc.so.6
#35 0x000055555cb83940 in ()
#36 0x000055555bbb10e0 in ()
#37 0x0000005f00000067 in ()
#38 0x0000006400000070 in ()
#39 0x0000002f00000066 in ()
#40 0x000000740000006c in ()
#41 0x0000002d00000063 in ()
#42 0x000000650000006c in ()
#43 0x0000006100000067 in ()
#44 0x0000007900000063 in ()
#45 0x0000006d0000002d in ()
#46 0x0000006f00000073 in ()
#47 0x0000002f00000070 in ()
#48 0x0000003500000030 in ()
#49 0x0000003800000030 in ()
#50 0x0000003600000031 in ()
#51 0x0000003900000036 in ()
#52 0x000000610000005f in ()
#53 0x0000006d0000005f in ()
#54 0x0000003100000073 in ()
#55 0x0000002e00000036 in ()
#56 0x0000006400000070 in ()
#57 0x0000002900000066 in ()
#58 0x000000200000002c in ()
#59 0x0000006500000067 in ()
#60 0x000000650000006e in ()
#61 0x0000006100000072 in ()
#62 0x0000006500000074 in ()
#63 0x0000002000000064 in ()
#64 0x0000006900000077 in ()
#65 0x0000006800000074 in ()
#66 0x0000006b00000020 in ()
#67 0x0000006300000069 in ()
#68 0x0000006400000061 in ()
#69 0x000000660000002d in ()
#70 0x0000006f0000006f in ()
#71 0x0000007000000074 in ()
#72 0x0000006900000072 in ()
#73 0x000000740000006e in ()
#74 0x000000670000002d in ()
#75 0x0000006e00000065 in ()
#76 0x0000007200000065 in ()
#77 0x0000007400000061 in ()
#78 0x000000720000006f in ()
#79 0x0000006900000020 in ()
#80 0x0000006300000070 in ()
#81 0x000000670000005f in ()
#82 0x0000006c00000075 in ()
#83 0x000000770000006c in ()
#84 0x0000006e00000069 in ()
#85 0x0000005f00000067 in ()
#86 0x0000006500000067 in ()
#87 0x000000650000006e in ()
#88 0x0000006100000072 in ()
#89 0x0000006f00000074 in ()
#90 0x0000002e00000072 in ()
#91 0x0000007900000070 in ()
#92 0x0000000000000000 in ()
>>>
KiCad Version
Application: KiCad
Version: 5.99.0-1.20210913gitfdfecf5.fc33, release build
Libraries:
wxWidgets 3.0.5
libcurl/7.71.1 OpenSSL/1.1.1k-fips zlib/1.2.11 brotli/1.0.9 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh/0.9.5/openssl/zlib nghttp2/1.43.0
Platform: Linux 5.13.12-100.fc33.x86_64 x86_64, 64 bit, Little endian, wxGTK, gnome-xorg, x11
Build Info:
Date: Sep 13 2021 17:23:22
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.73.0
OCC: 7.5.0
Curl: 7.71.1
ngspice: 33
Compiler: GCC 10.3.1 with C++ ABI 1014
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON