Fix #8402: prevent dereferencing invalid iterator (#8504)

This commit is contained in:
ζeh Matt 2018-12-20 22:25:10 +01:00 committed by Michał Janiszewski
parent c0fc5142ac
commit c457de1ece
2 changed files with 7 additions and 2 deletions

View File

@ -39,6 +39,7 @@
- Fix: [#8204] Crash when tile element has no surface elements.
- Fix: [#8335] Rides with arbitrary ride types can crash the game when they break down.
- Fix: [#8358] Infinite loop when changing vehicle count on stopped ride.
- Fix: [#8402] Crash closing a window in some cases.
- Fix: [#8431] Crash when game action logging is enabled.
- Fix: [#8433] Crash if master server response is not valid JSON.
- Fix: [#8434] Crash if curl_easy_init fails.

View File

@ -105,8 +105,10 @@ static void input_update_tooltip(rct_window* w, rct_widgetindex widgetIndex, int
*/
void game_handle_input()
{
for (auto& w : g_window_list)
// NOTE: g_window_list may change during the event callbacks.
for (size_t i = g_window_list.size(); i > 0; i--)
{
auto& w = g_window_list[i - 1];
window_event_unknown_07_call(w.get());
}
@ -134,8 +136,10 @@ void game_handle_input()
process_mouse_tool(x, y);
}
for (auto& w : g_window_list)
// NOTE: g_window_list may change during the event callbacks.
for (size_t i = g_window_list.size(); i > 0; i--)
{
auto& w = g_window_list[i - 1];
window_event_unknown_08_call(w.get());
}
}