From 8a46c017cf7c3a367a5caaa06c34921bbe76feb2 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 17 May 2011 23:16:40 +0200 Subject: GUI: Fix for bug #3303501 "Switching from HQ2x->HQ3x crashes ScummVM". --- gui/options.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gui') 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:"; -- cgit v1.2.3