aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kmisc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index bd1cf587ea..0c190d0e94 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -159,7 +159,11 @@ reg_t kMemorySegment(EngineState *s, int argc, reg_t *argv) {
}
reg_t kFlushResources(EngineState *s, int argc, reg_t *argv) {
- run_gc(s);
+ // We used to call run_gc() directly from here. This is no longer safe
+ // as we now always add our fake "kernel" stack frame for debugging
+ // purposes. Instead of calling run_gc(), we set gc_countdown to 1
+ // to make the garbage collector run before the next kernel function.
+ s->gc_countdown = 1;
debugC(2, kDebugLevelRoom, "Entering room number %d", argv[0].toUint16());
return s->r_acc;
}