From 529d84a57bf402b91e4e6d8a6446438e89494784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 7 Mar 2017 15:22:34 +0100 Subject: [PATCH] Avoid a crash if trying to do two screen switches at once. Managed to make this happen while using the UWP File Open dialog - it lagged and I started another action while it hadn't returned. --- ext/native/ui/screen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/native/ui/screen.cpp b/ext/native/ui/screen.cpp index 3dac293149..e12da51c97 100644 --- a/ext/native/ui/screen.cpp +++ b/ext/native/ui/screen.cpp @@ -25,7 +25,9 @@ void ScreenManager::switchScreen(Screen *screen) { // until that switch. // TODO: is this still true? if (nextScreen_ != 0) { - FLOG("Already had a nextScreen_"); + ELOG("Already had a nextScreen_! Asynchronous open while doing something? Deleting the new screen."); + delete screen; + return; } if (screen == 0) { WLOG("Swiching to a zero screen, this can't be good");