aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorFilippos Karapetis2013-07-05 02:56:12 +0300
committerFilippos Karapetis2013-07-05 02:56:12 +0300
commit93987d999c61221bda3da548c8c81f5d6d906a12 (patch)
tree8cab48325f969f7b596af00d1a7eaa1a0dc46bf7 /common
parent71b031be12540dc2e19935d2754191d2267d5e18 (diff)
downloadscummvm-rg350-93987d999c61221bda3da548c8c81f5d6d906a12.tar.gz
scummvm-rg350-93987d999c61221bda3da548c8c81f5d6d906a12.tar.bz2
scummvm-rg350-93987d999c61221bda3da548c8c81f5d6d906a12.zip
COMMON: Fix crash when the keymapper and the event recorder are enabled
DefaultEventManager registers a keymapper that is supposed to be auto-freed. However, the event recorder then sets itself as a new keymapper, but because the autofree flag is already set, registerMapper() ends up deleting the event recorder itself. Setting the autofree flag before actually freeing the mapper fixes the issue and prevents ScummVM from crashing on startup
Diffstat (limited to 'common')
-rw-r--r--common/EventDispatcher.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index e60c1aa7ff..20a5b5eaac 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -71,11 +71,11 @@ void EventDispatcher::dispatch() {
}
void EventDispatcher::registerMapper(EventMapper *mapper, bool autoFree) {
+ _autoFreeMapper = autoFree;
if (_autoFreeMapper) {
delete _mapper;
}
_mapper = mapper;
- _autoFreeMapper = autoFree;
}