1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix #9752: window_close from ride construction window causes a crash

Re-obtain iterator after calling window close event as close event may open / close other windows.
This commit is contained in:
Ted John
2019-08-07 23:20:50 +01:00
parent b17e9b1b18
commit cbb1bf9289

View File

@@ -230,7 +230,10 @@ void window_close(rct_window* w)
// Invalidate the window (area)
window_invalidate(window.get());
g_window_list.erase(itWindow);
// The window list may have been modified in the close event
itWindow = window_get_iterator(w);
if (itWindow != g_window_list.end())
g_window_list.erase(itWindow);
}
template<typename _TPred> static void window_close_by_condition(_TPred pred, uint32_t flags = WindowCloseFlags::None)