From 9640048ad6e65c209251f68153dbc1560ee65676 Mon Sep 17 00:00:00 2001 From: dhewg Date: Tue, 5 Apr 2011 12:28:39 +0200 Subject: GUI: Update the screen after handling events Fixes crash on droid: game -> gmm -> save -> click entry (EVENT_SCREEN_CHANGED due to vkeybd beeing shown) -> delete -> confirm another EVENT_SCREEN_CHANGED gets in simultaneously (due vkeybd being deactivated) and the parent dialog updated Rects out of bounds. --- gui/gui-manager.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 3ad4b2ee18..0cb06458ef 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -294,7 +294,6 @@ void GuiManager::runLoop() { Common::Event event; while (eventMan->pollEvent(event)) { - // The top dialog can change during the event loop. In that case, flush all the // dialog-related events since they were probably generated while the old dialog // was still visible, and therefore not intended for the new one. @@ -306,12 +305,6 @@ void GuiManager::runLoop() { Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); - if (lastRedraw + waitTime < _system->getMillis()) { - _theme->updateScreen(); - _system->updateScreen(); - lastRedraw = _system->getMillis(); - } - switch (event.type) { case Common::EVENT_KEYDOWN: activeDialog->handleKeyDown(event.kbd); @@ -366,6 +359,12 @@ void GuiManager::runLoop() { default: break; } + + if (lastRedraw + waitTime < _system->getMillis()) { + _theme->updateScreen(); + _system->updateScreen(); + lastRedraw = _system->getMillis(); + } } if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis()) { -- cgit v1.2.3