diff options
-rw-r--r-- | gui/gui-manager.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 64853b5096..5b8c03c672 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -279,7 +279,7 @@ void GuiManager::runLoop() { bool tooltipCheck = false; - while (!_dialogStack.empty() && activeDialog == getTopDialog()) { + while (!_dialogStack.empty() && activeDialog == getTopDialog() && !eventMan->shouldQuit()) { redraw(); // Don't "tickle" the dialog until the theme has had a chance @@ -358,8 +358,6 @@ void GuiManager::runLoop() { case Common::EVENT_WHEELDOWN: activeDialog->handleMouseWheel(mouse.x, mouse.y, 1); break; - case Common::EVENT_QUIT: - return; case Common::EVENT_SCREEN_CHANGED: screenChange(); break; @@ -388,6 +386,17 @@ void GuiManager::runLoop() { _system->delayMillis(10); } + // WORKAROUND: When quitting we might not properly close the dialogs on + // the dialog stack, thus we do this here to avoid any problems. + // This is most noticable in bug #3481395 "LAUNCHER: Can't quit from unsupported game dialog". + // It seems that Dialog::runModal never removes the dialog from the dialog + // stack, thus if the dialog does not call Dialog::close to close itself + // it will never be removed. Since we can have multiple run loops being + // called we cannot rely on catching EVENT_QUIT in the event loop above, + // since it would only catch it for the top run loop. + if (eventMan->shouldQuit() && activeDialog == getTopDialog()) + getTopDialog()->close(); + if (didSaveState) { _theme->disable(); restoreState(); |