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

bluegr md5 at scummvm.org
Tue Jul 3 02:35:36 CEST 2012


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:
c80429008f SCI: Remove an unnecessary warning and related FIXME comments


Commit: c80429008f135c236544846920f488680fa7c200
    https://github.com/scummvm/scummvm/commit/c80429008f135c236544846920f488680fa7c200
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-02T17:34:30-07:00

Commit Message:
SCI: Remove an unnecessary warning and related FIXME comments

It's perfectly normal behavior to have locals with a smaller segment ID
than the ID of their respective script, e.g. when scripts are
uninstantiated and then instantiated again

Changed paths:
    engines/sci/engine/seg_manager.cpp



diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index d425e17..951fc7c 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -154,22 +154,15 @@ void SegManager::deallocate(SegmentId seg) {
 		Script *scr = (Script *)mobj;
 		_scriptSegMap.erase(scr->getScriptNumber());
 		if (scr->getLocalsSegment()) {
-			// HACK: Check if the locals segment has already been deallocated.
-			// This happens sometimes in SQ4CD when resetting the segment
-			// manager: the locals for script 808 are somehow stored in a
-			// smaller segment than the script itself, so by the time the script
-			// is about to be freed, the locals block has already been freed.
-			// This isn't fatal, but it shouldn't be happening at all.
-			// FIXME: Check why this happens. Perhaps there's a bug in the
-			// script handling code?
-			if (!_heap[scr->getLocalsSegment()]) {
-				warning("SegManager::deallocate(): The locals block of script "
-						"%d has already been deallocated. Script segment: %d, "
-						"locals segment: %d", scr->getScriptNumber(), seg,
-						scr->getLocalsSegment());
-			} else {
+			// Check if the locals segment has already been deallocated.
+			// If the locals block has been stored in a segment with an ID
+			// smaller than the segment ID of the script itself, it will be
+			// already freed at this point. This can happen when scripts are
+			// uninstantiated and instantiated again: they retain their own
+			// segment ID, but are allocated a new locals segment, which can
+			// have an ID smaller than the segment of the script itself.
+			if (_heap[scr->getLocalsSegment()])
 				deallocate(scr->getLocalsSegment());
-			}
 		}
 	}
 






More information about the Scummvm-git-logs mailing list