mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
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.
This commit is contained in:
parent
42c9b1a2c1
commit
278a14d96e
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user