From 709a2c3d2a79e884912ae7f374a8ccba42370719 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 7 Nov 2016 09:32:06 +0800 Subject: [PATCH] Fixes freeze when starting new game or editor Fixes freeze introduced by 9511f65 where event_process wouldn't go to the next window if it's hidden. --- common/arch/sdl/event.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/common/arch/sdl/event.cpp b/common/arch/sdl/event.cpp index 80f968e45..40b1a2261 100644 --- a/common/arch/sdl/event.cpp +++ b/common/arch/sdl/event.cpp @@ -161,21 +161,14 @@ window_event_result event_process(void) return highest_result; event.type = EVENT_WINDOW_DRAW; // then draw all visible windows - wind = window_get_first(); - while (wind != NULL) + for (wind = window_get_first(); wind != nullptr; wind = window_get_next(*wind)) { - window *prev = window_get_prev(*wind); if (window_is_visible(wind)) { + auto prev = window_get_prev(*wind); auto result = window_send_event(*wind, event); if (result == window_event_result::deleted) - { - if (!prev) // well there isn't a previous window ... - break; // ... just bail out - we've done everything for this frame we can. - wind = window_get_next(*prev); // the current window seemed to be closed. so take the next one from the previous which should be able to point to the one after the current closed - } - else - wind = window_get_next(*wind); + wind = prev; // take the previous window and get the next one from that (if prev isn't nullptr) highest_result = std::max(result, highest_result); }