Files
CMake/Source/QtDialog
Joerg Bornemann 6862249daa cmake-gui: Fix crash when selecting a preset with a differing build dir
QCMake::setPreset() bound a reference to the selected preset's expanded
data inside CMakePresetsGraph.ConfigurePresets and then called
setBinaryDirectory().  When the selected preset's build directory holds a
cache whose CMAKE_HOME_DIRECTORY differs from the current source
directory (e.g. because the source path is reached through a symbolic
link, since browsing keeps the link unresolved while the cache stores the
real path), setBinaryDirectory() loads that cache and re-sets the source
directory.  That re-reads the presets graph via loadPresets(), which
calls ClearPresets() and destroys the map entry, leaving the reference
dangling.  Subsequent access crashed with a use-after-free.

Copy the expanded preset instead of holding a reference into the graph so
it stays valid across setBinaryDirectory().

Fixes: #27927
2026-07-09 09:28:26 -04:00
..