1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 23:33:04 +01:00

Merge pull request #9368 from ZehMatt/fix-9365

Fix #9365: Crash when bringing window to front
This commit is contained in:
Duncan
2019-06-04 18:45:22 +01:00
committed by GitHub

View File

@@ -683,9 +683,6 @@ rct_window* window_bring_to_front(rct_window* w)
auto itSourcePos = window_get_iterator(w); auto itSourcePos = window_get_iterator(w);
if (itSourcePos != g_window_list.end()) if (itSourcePos != g_window_list.end())
{ {
auto wptr = std::move(*itSourcePos);
g_window_list.erase(itSourcePos);
// Insert in front of the first non-stick-to-front window // Insert in front of the first non-stick-to-front window
auto itDestPos = g_window_list.begin(); auto itDestPos = g_window_list.begin();
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++) for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
@@ -698,7 +695,7 @@ rct_window* window_bring_to_front(rct_window* w)
} }
} }
g_window_list.insert(itDestPos, std::move(wptr)); g_window_list.splice(itDestPos, g_window_list, itSourcePos);
window_invalidate(w); window_invalidate(w);
if (w->x + w->width < 20) if (w->x + w->width < 20)