From 57585171de9d428a7cd87ac0bc2a528475286a59 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Fri, 28 Oct 2016 08:35:40 +0800 Subject: [PATCH] Check for window_event_result::deleted in event_process drawing loop This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one. --- common/arch/sdl/event.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/arch/sdl/event.cpp b/common/arch/sdl/event.cpp index 52d7440c2..1be0607b9 100644 --- a/common/arch/sdl/event.cpp +++ b/common/arch/sdl/event.cpp @@ -165,9 +165,10 @@ void event_process(void) while (wind != NULL) { window *prev = window_get_prev(*wind); + window_event_result result(window_event_result::ignored); if (window_is_visible(wind)) - window_send_event(*wind, event); - if (!window_exists(wind)) + 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.