diff options
author | Torbjörn Andersson | 2014-08-07 22:55:52 +0200 |
---|---|---|
committer | Torbjörn Andersson | 2014-08-07 22:55:52 +0200 |
commit | 278a14d96ef40acabaf038f70662be671d9093fc (patch) | |
tree | d7baeb6d42464b3101cc4fbb28acc5cd1ea6ca12 | |
parent | 42c9b1a2c18a5741bd5eeeaa3d33ca6f65ac235d (diff) | |
download | scummvm-rg350-278a14d96ef40acabaf038f70662be671d9093fc.tar.gz scummvm-rg350-278a14d96ef40acabaf038f70662be671d9093fc.tar.bz2 scummvm-rg350-278a14d96ef40acabaf038f70662be671d9093fc.zip |
COMMON: Fix crash when quitting on "Game data not found" dialog
ScummVM would try to look up "confirm_exit" in the active domain,
even though the active domain had been removed and pointed to an
invalid address. To avoid this, try to keep _activeDomain and
_activeDomainName updated if removeGameDomain() removes the active
domain.
For good measure, also do it if the active domain is removed by
renameGameDomain(), though I don't know if there was any case where
this would have caused trouble.
-rw-r--r-- | common/config-manager.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index a34e32cfc1..04b62371b2 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -626,6 +626,10 @@ void ConfigManager::addMiscDomain(const String &domName) { void ConfigManager::removeGameDomain(const String &domName) { assert(!domName.empty()); assert(isValidDomainName(domName)); + if (domName == _activeDomainName) { + _activeDomainName = ""; + _activeDomain = 0; + } _gameDomains.erase(domName); } @@ -638,6 +642,10 @@ void ConfigManager::removeMiscDomain(const String &domName) { void ConfigManager::renameGameDomain(const String &oldName, const String &newName) { renameDomain(oldName, newName, _gameDomains); + if (_activeDomainName == oldName) { + _activeDomainName = newName; + _activeDomain = &_gameDomains[newName]; + } } void ConfigManager::renameMiscDomain(const String &oldName, const String &newName) { |