From 4c03e4b699916a9b9fe71afffaf41c283045216e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 26 Apr 2015 00:43:53 +0200 Subject: SCI: Stop processing in kGetEvent after loading getSciEvent can trigger the main ScummVM menu, which can trigger loading a game, which will invalidate the game state that kGetEvent is operating on. Other kernel functions may still have the same problem, and a better solution may be necessary. --- engines/sci/engine/kevent.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/sci/engine/kevent.cpp') diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index cb81da2279..dfa29bd047 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -74,6 +74,11 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { curEvent = g_sci->getEventManager()->getSciEvent(mask); + // Aborted during getSciEvent (e.g., due to loading a game from the + // ScummVM menu), so return immediately + if (s->abortScriptProcessing) + return NULL_REG; + // For a real event we use its associated mouse position mousePos = curEvent.mousePos; #ifdef ENABLE_SCI32 -- cgit v1.2.3