[Scummvm-cvs-logs] SF.net SVN: scummvm:[51152] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Jul 22 19:25:21 CEST 2010
Revision: 51152
http://scummvm.svn.sourceforge.net/scummvm/?rev=51152&view=rev
Author: thebluegr
Date: 2010-07-22 17:25:21 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
SCI: Fixed the crash in LSL2, room 42 (when arriving at the island). kAnimate may refer to unfrozen objects which have been deleted, thus handle that case accordingly.
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/seg_manager.cpp
scummvm/trunk/engines/sci/engine/seg_manager.h
scummvm/trunk/engines/sci/graphics/animate.cpp
Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp 2010-07-22 17:12:51 UTC (rev 51151)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp 2010-07-22 17:25:21 UTC (rev 51152)
@@ -508,7 +508,7 @@
return &(lt->_table[addr.offset]);
}
-Node *SegManager::lookupNode(reg_t addr) {
+Node *SegManager::lookupNode(reg_t addr, bool stopOnDiscarded) {
if (addr.isNull())
return NULL; // Non-error null
@@ -522,6 +522,9 @@
NodeTable *nt = (NodeTable *)_heap[addr.segment];
if (!nt->isValidEntry(addr.offset)) {
+ if (!stopOnDiscarded)
+ return NULL;
+
error("Attempt to use invalid or discarded reference %04x:%04x as list node", PRINT_REG(addr));
return NULL;
}
Modified: scummvm/trunk/engines/sci/engine/seg_manager.h
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.h 2010-07-22 17:12:51 UTC (rev 51151)
+++ scummvm/trunk/engines/sci/engine/seg_manager.h 2010-07-22 17:25:21 UTC (rev 51152)
@@ -232,7 +232,7 @@
* @param addr The address to resolve
* @return The list node referenced, or NULL on error
*/
- Node *lookupNode(reg_t addr);
+ Node *lookupNode(reg_t addr, bool stopOnDiscarded = true);
// 8. Hunk Memory
Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp 2010-07-22 17:12:51 UTC (rev 51151)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp 2010-07-22 17:25:21 UTC (rev 51152)
@@ -98,8 +98,10 @@
if (_s->abortScriptProcessing != kAbortNone || g_engine->shouldQuit())
return true; // Stop processing
- // Lookup node again, since the nodetable it was in may have been reallocated
- curNode = _s->_segMan->lookupNode(curAddress);
+ // Lookup node again, since the nodetable it was in may have been reallocated.
+ // The node might have been deallocated at this point (e.g. LSL2, room 42),
+ // in which case the node reference will be null and the loop will stop below.
+ curNode = _s->_segMan->lookupNode(curAddress, false);
}
if (curNode) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list