[Scummvm-cvs-logs] scummvm master -> c01fed7159c313680e55458efb6529d332ebc8b0

wjp wjp at usecode.org
Fri May 13 23:10:35 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c01fed7159 SCI: Avoid incrementing lockers of deleted script


Commit: c01fed7159c313680e55458efb6529d332ebc8b0
    https://github.com/scummvm/scummvm/commit/c01fed7159c313680e55458efb6529d332ebc8b0
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-05-13T14:09:04-07:00

Commit Message:
SCI: Avoid incrementing lockers of deleted script

Having a deleted script with non-zero lockers had the side effect of
making the deleted script re-appear in the GC's work list, including
any (deleted) objects in the script.

This should be the root cause of bugs #3299458 and #3295849, so
also delete the workaround added for that in 35086fe1.

Changed paths:
    engines/sci/engine/gc.cpp
    engines/sci/engine/kscripts.cpp
    engines/sci/engine/script.cpp



diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index b40677d..2d71878 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -87,14 +87,7 @@ static void processWorkList(SegManager *segMan, WorklistManager &wm, const Commo
 		wm._worklist.pop_back();
 		if (reg.segment != stackSegment) { // No need to repeat this one
 			debugC(kDebugLevelGC, "[GC] Checking %04x:%04x", PRINT_REG(reg));
-			// WORKAROUND: We only check for valid offsets here. Fixes bugs
-			// #3299458 and #3295849.
-			// FIXME: Where are these invalid offsets coming from? The check
-			// below avoids a crash when examining invalid references, but the
-			// root of the problem lies elsewhere. These shouldn't be in the
-			// stack at all (unless these really are script bugs, in which case
-			// we should just keep the sanity check).
-			if (reg.segment < heap.size() && heap[reg.segment] && heap[reg.segment]->isValidOffset(reg.offset)) {
+			if (reg.segment < heap.size() && heap[reg.segment]) {
 				// Valid heap object? Find its outgoing references!
 				wm.pushArray(heap[reg.segment]->listAllOutgoingReferences(reg));
 			}
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index c905f22..b48de1c 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -259,7 +259,7 @@ reg_t kDisposeScript(EngineState *s, int argc, reg_t *argv) {
 
 	SegmentId id = s->_segMan->getScriptSegment(script);
 	Script *scr = s->_segMan->getScriptIfLoaded(id);
-	if (scr) {
+	if (scr && !scr->isMarkedAsDeleted()) {
 		if (s->_executionStack.back().addr.pc.segment != id)
 			scr->setLockers(1);
 	}
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 7ae28ac..eae2dd6 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -380,6 +380,7 @@ void Script::relocateSci3(reg_t block) {
 }
 
 void Script::incrementLockers() {
+	assert(!_markedAsDeleted);
 	_lockers++;
 }
 
@@ -393,6 +394,7 @@ int Script::getLockers() const {
 }
 
 void Script::setLockers(int lockers) {
+	assert(lockers == 0 || !_markedAsDeleted);
 	_lockers = lockers;
 }
 






More information about the Scummvm-git-logs mailing list