aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorJohannes Schickel2011-05-17 23:16:40 +0200
committerJohannes Schickel2011-05-17 23:16:40 +0200
commit8a46c017cf7c3a367a5caaa06c34921bbe76feb2 (patch)
tree3851f7ad567c6729598f08cfd0e885630a16a39d /gui
parent8c38275e656acbc309bfe9701eb7ba7127a3a27d (diff)
downloadscummvm-rg350-8a46c017cf7c3a367a5caaa06c34921bbe76feb2.tar.gz
scummvm-rg350-8a46c017cf7c3a367a5caaa06c34921bbe76feb2.tar.bz2
scummvm-rg350-8a46c017cf7c3a367a5caaa06c34921bbe76feb2.zip
GUI: Fix for bug #3303501 "Switching from HQ2x->HQ3x crashes ScummVM".
Diffstat (limited to 'gui')
-rw-r--r--gui/options.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index e42d6c62ee..5cb70bc5e4 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -357,6 +357,19 @@ void OptionsDialog::close() {
if (ConfMan.hasKey("fullscreen"))
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen", _domain));
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
+
+ // Since this might change the screen resolution we need to give
+ // the GUI a chance to update it's internal state. Otherwise we might
+ // get a crash when the GUI tries to grab the overlay.
+ //
+ // This fixes bug #3303501 "Switching from HQ2x->HQ3x crashes ScummVM"
+ //
+ // It is important that this is called *before* any of the current
+ // dialog's widgets are destroyed (for example before
+ // Dialog::close) is called, to prevent crashes caused by invalid
+ // widgets being referenced or similar errors.
+ g_gui.checkScreenChange();
+
if (gfxError != OSystem::kTransactionSuccess) {
// Revert ConfMan to what OSystem is using.
Common::String message = "Failed to apply some of the graphic options changes:";