Commit 1a34123
fix qtfred heap corruption in FastDebug builds (scp-fs2open#7450)
FastDebug FSO compiled with /MDd (debug CRT) but imported Qt's Release
libraries via CMAKE_MAP_IMPORTED_CONFIG_FASTDEBUG = Release Debug. Qt
Release ships /MD, so any allocation crossing the qtfred <-> Qt boundary
went into one heap and came back out of the other, tripping
_CrtIsValidHeapPointer on a perfectly-valid std::string dtor. Latent for
ages because it only surfaces when an allocation actually crosses;
opening a mission file is one such path.
To paper over the resulting STL layout difference, FastDebug also forced
_ITERATOR_DEBUG_LEVEL=0 so qtfred's std::string matched Release Qt's.
Not needed once we link Debug Qt, and keeping it would introduce a fresh
mismatch (qtfred IDL=0 vs Debug Qt IDL=2).
Fix:
- Map FastDebug imports to "Debug Release \"\"" in qtfred/CMakeLists.
Debug picks Qt's debug libs; Release is a defensive fallback; the
empty entry falls back to plain IMPORTED_LOCATION, required because
Qt's host tools (uic/moc/rcc/qhelpgenerator) ship a single variant
with no IMPORTED_LOCATION_<CONFIG>. Must precede find_package(Qt5):
CMake snapshots the variable into each target's MAP_IMPORTED_CONFIG
property at creation time. (Also why the prior "Release Debug" was
silently a no-op -- set after find_package, ignored; CMake fell
back to Release on its own.)
- Extend the qwindows/qsqlite plugin POST_BUILD copies' "d"-suffix
generator expression to match FastDebug as well as Debug, so the
Debug Qt runtime finds qwindowsd.dll / qsqlited.dll alongside.
- Drop the FastDebug-only _ITERATOR_DEBUG_LEVEL=0 from the MSVC
toolchain file. Qt was the sole consumer; pure-C deps don't care.
Cost: FastDebug STL containers pick up MSVC's debug-iterator overhead.
Reasonable trade for a config named "Debug with optimizations".
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 2046f9b commit 1a34123
2 files changed
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | 117 | | |
119 | 118 | | |
120 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
11 | 23 | | |
12 | 24 | | |
13 | 25 | | |
| |||
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
54 | | - | |
55 | | - | |
56 | 66 | | |
57 | 67 | | |
58 | 68 | | |
| |||
169 | 179 | | |
170 | 180 | | |
171 | 181 | | |
172 | | - | |
| 182 | + | |
173 | 183 | | |
174 | 184 | | |
175 | 185 | | |
176 | | - | |
| 186 | + | |
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
| |||
182 | 192 | | |
183 | 193 | | |
184 | 194 | | |
185 | | - | |
| 195 | + | |
186 | 196 | | |
187 | 197 | | |
188 | 198 | | |
189 | | - | |
| 199 | + | |
190 | 200 | | |
191 | 201 | | |
192 | 202 | | |
| |||
0 commit comments