aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-10-26 20:35:06 +0000
committerNicola Mettifogo2007-10-26 20:35:06 +0000
commit22c4aa0602afd9ea792773770fd919aeea0112ce (patch)
tree72381396370283d5982b39d04ab11ad387ae9075
parent1e32d188f91de248fd3ac9d8e9521eec71430925 (diff)
downloadscummvm-rg350-22c4aa0602afd9ea792773770fd919aeea0112ce.tar.gz
scummvm-rg350-22c4aa0602afd9ea792773770fd919aeea0112ce.tar.bz2
scummvm-rg350-22c4aa0602afd9ea792773770fd919aeea0112ce.zip
Parallaction will now consume all the short-lived jobs in the queue before a location switch. These jobs only live for 1 or 2 engine loops, and can refer to items in the location being dropped. This situation used to lead to segfaults like the one reported in report #1762797 (that should be now fixed).
svn-id: r29263
-rw-r--r--engines/parallaction/parallaction_ns.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 5ec5606845..9bf5915ec3 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -257,6 +257,12 @@ void Parallaction_ns::changeLocation(char *location) {
_animations.remove(&_char._ani);
+ // WORKAROUND: eat up any pending short-lived job that may be referring to the
+ // current location before the actual switch is performed, or engine may
+ // segfault because of invalid pointers.
+ runJobs();
+ runJobs();
+
freeLocation();
char buf[100];
strcpy(buf, location);