Crash attempting to edit footprint properties in PCB editor

Description

There is a serious regression in the 9.0 branch which appears to have been around since 9.0.0. It does not affect the master branch. Attempting to launch the properties dialog for a footprint causes a crash with the following back trace on Linux. This is 100% reproducible on Linux.

Click to show/hide backtrace.
Thread 1 "kicad" received signal SIGSEGV, Segmentation fault.
0x00007fffaa783e8a in FILENAME_RESOLVER::GetKicadPaths (this=0x5555605ee950, 
    paths=empty std::__cxx11::list)
    at /home/foo/src/kicad-stable/common/filename_resolver.cpp:844
844	    ENV_VAR_MAP_CITER mS = m_pgm->GetLocalEnvVariables().begin();
(gdb) bt
#0  0x00007fffaa783e8a in FILENAME_RESOLVER::GetKicadPaths
    (this=0x5555605ee950, paths=empty std::__cxx11::list)
    at /home/foo/src/kicad-stable/common/filename_resolver.cpp:844
#1  0x00007fffaa77e490 in FILENAME_RESOLVER::createPathList
    (this=0x5555605ee950)
    at /home/foo/src/kicad-stable/common/filename_resolver.cpp:177
#2  0x00007fffaa77d9a8 in FILENAME_RESOLVER::Set3DConfigDir
    (this=0x5555605ee950, aConfigDir=...)
    at /home/foo/src/kicad-stable/common/filename_resolver.cpp:75
#3  0x00007fffa9d00d25 in S3D_CACHE::Set3DConfigDir
    (this=0x5555608280c0, aConfigDir=...)
    at /home/foo/src/kicad-stable/3d-viewer/3d_cache/3d_cache.cpp:441
#4  0x00007fffaa0d5478 in PROJECT_PCB::Get3DCacheManager
    (aProject=0x5555562aec20, aUpdateProjDir=false)
    at /home/foo/src/kicad-stable/pcbnew/project_pcb.cpp:94
#5  0x00007fffa8efa93d in PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL
    (this=0x555560506f30, aFrame=0x5555573d7520, aFootprint=0x5555602098d0, aDialogParent=0x7fffe41a3af0, aFilesPanel=0x555560a7c980, aParent=0x55556078f4d0, aId=-1, aPos=..., aSize=..., aStyle=524288, aName=...)
    at /home/foo/src/kicad-stable/pcbnew/dialogs/panel_fp_properties_3d_model.cpp:122
#6  0x00007fffa8be56f0 in DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES (this=0x7fffe41a3af0, aParent=0x5555573d7520, aFootprint=0x5555602098d0)
    at /home/foo/src/kicad-stable/pcbnew/dialogs/dialog_footprint_properties.cpp:76
#7  0x00007fffa94ab99d in PCB_EDIT_FRAME::ShowFootprintPropertiesDialog
    (this=0x5555573d7520, aFootprint=0x5555602098d0)
    at /home/foo/src/kicad-stable/pcbnew/pcb_edit_frame.cpp:2181
#8  0x00007fffa9393ab7 in PCB_EDIT_FRAME::OnEditItemRequest
    (this=0x5555573d7520, aItem=0x5555602098d0)
    at /home/foo/src/kicad-stable/pcbnew/edit.cpp:142
#9  0x00007fffa96a57d3 in EDIT_TOOL::Properties
    (this=0x555557666480, aEvent=...)
    at /home/foo/src/kicad-stable/pcbnew/tools/edit_tool.cpp:1957
#10 0x00007fffa96cd32f in std::__invoke_impl<int, int (EDIT_TOOL::*&)(TOOL_EVENT const&), EDIT_TOOL*&, TOOL_EVENT const&>
    (__f=@0x555560aa33e0: (int (EDIT_TOOL::*)(EDIT_TOOL * const, const TOOL_EVENT &)) 0x7fffa96a41b8 <EDIT_TOOL::Properties(TOOL_EVENT const&)>, __t=@0x555560aa33f0: 0x555557666480) at /usr/include/c++/14/bits/invoke.h:74
#11 0x00007fffa96cd149 in std::__invoke<int (EDIT_TOOL::*&)(TOOL_EVENT const&), EDIT_TOOL*&, TOOL_EVENT const&>
--Type <RET> for more, q to quit, c to continue without paging--
    (__fn=@0x555560aa33e0: (int (EDIT_TOOL::*)(EDIT_TOOL * const, const TOOL_EVENT &)) 0x7fffa96a41b8 <EDIT_TOOL::Properties(TOOL_EVENT const&)>)
    at /usr/include/c++/14/bits/invoke.h:96
#12 0x00007fffa96ccaa1 in std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::__call<int, TOOL_EVENT const&, 0ul, 1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>)
    (this=0x555560aa33e0, __args=...) at /usr/include/c++/14/functional:513
#13 0x00007fffa96cc4cd in std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT const&) (this=0x555560aa33e0) at /usr/include/c++/14/functional:598
#14 0x00007fffa96cbad3 in std::__invoke_impl<int, std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>&, TOOL_EVENT const&>(std::__invoke_other, std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>&, TOOL_EVENT const&) (__f=...)
    at /usr/include/c++/14/bits/invoke.h:61
#15 0x00007fffa96ca721 in std::__invoke_r<int, std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>&, TOOL_EVENT const&>(std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>&, TOOL_EVENT const&) (__fn=...) at /usr/include/c++/14/bits/invoke.h:114
#16 0x00007fffa96c8b97 in std::_Function_handler<int (TOOL_EVENT const&), std::_Bind<int (EDIT_TOOL::*(EDIT_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)> >::_M_invoke(std::_Any_data const&, TOOL_EVENT const&)
    (__functor=..., __args#0=...)
    at /usr/include/c++/14/bits/std_function.h:290
#17 0x00007fffaa87de8f in std::function<int(TOOL_EVENT const&)>::operator()
    (this=0x5555596b3d38, __args#0=...)
    at /usr/include/c++/14/bits/std_function.h:591
#18 0x00007fffaa87af6e in COROUTINE<int, TOOL_EVENT const&>::callerStub
    (aData=140737488331696)
    at /home/foo/src/kicad-stable/include/tool/coroutine.h:513
#19 0x00007fffaad2e441 in make_fcontext ()
    at /home/foo/build/kicad/9.0-debug/pcbnew/_pcbnew.kiface
#20 0x00010102464c457f in ??? ()
#21 0x0000000000000000 in ??? ()

Steps to reproduce

  1. Open any board in Pcbnew.
  2. LMB select any footprint.
  3. Press the E key to launch the footprint properties dialog.
  4. Observe crash shown in the back trace above.

KiCad Version

Application: KiCad PCB Editor x86_64 on x86_64

Version: 9.0.3-370-g38f4f04a18, debug build

Libraries:
	wxWidgets 3.2.8
	FreeType 2.13.3
	HarfBuzz 10.2.0
	FontConfig 2.15.0
	libcurl/8.14.1 OpenSSL/3.5.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10

Platform: Debian GNU/Linux 13 (trixie), 64 bit, Little endian, wxGTK, X11, gnome, x11
OpenGL: NVIDIA Corporation, NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2, 4.6.0 NVIDIA 550.163.01

Build Info:
	Date: Jul 29 2025 08:03:27
	wxWidgets: 3.2.8 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.83.0
	OCC: 7.8.1
	Curl: 8.14.1
	ngspice: 44.2
	Compiler: GCC 14.2.0 with C++ ABI 1019

Build settings:
	KICAD_IPC_API=ON
	KICAD_STDLIB_DEBUG=OFF
	KICAD_STDLIB_LIGHT_DEBUG=OFF
	KICAD_SANITIZE_ADDRESS=OFF
	KICAD_SANITIZE_THREADS=OFF

Locale: 
	Lang: en_US
	Enc: UTF-8
	Num: 1,234.5
	Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)