GUI: Check for screen change whenever an event is polled.

This should *hopefully* really fix all GUI crashes when resizing with OpenGL.
This commit is contained in:
Johannes Schickel 2013-10-18 00:51:52 +02:00
parent bb1d49ba9c
commit fa90f9797c

View File

@ -309,6 +309,19 @@ void GuiManager::runLoop() {
Common::Event event;
while (eventMan->pollEvent(event)) {
// We will need to check whether the screen changed while polling
// for an event here. While we do send EVENT_SCREEN_CHANGED
// whenever this happens we still cannot be sure that we get such
// an event immediately. For example, we might have an mouse move
// event queued before an screen changed event. In some rare cases
// this would make the GUI redraw (with the code a few lines
// below) when it is not yet updated for new overlay dimensions.
// As a result ScummVM would crash because it tries to copy data
// outside the actual overlay screen.
if (event.type != Common::EVENT_SCREEN_CHANGED) {
checkScreenChange();
}
// 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.