[Scummvm-cvs-logs] SF.net SVN: scummvm:[54306] scummvm/trunk/engines/sci/engine/klists.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Wed Nov 17 22:47:05 CET 2010
Revision: 54306
http://scummvm.svn.sourceforge.net/scummvm/?rev=54306&view=rev
Author: thebluegr
Date: 2010-11-17 21:47:05 +0000 (Wed, 17 Nov 2010)
Log Message:
-----------
SCI: Call lookupArray() after allocateArray() when duplicating arrays
This ensures that the pointer to the element that lookupArray() returned
won't be invalidated in case the array is reallocated because of
allocateArray() - same issue as in kClone()
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/klists.cpp
Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp 2010-11-17 20:50:24 UTC (rev 54305)
+++ scummvm/trunk/engines/sci/engine/klists.cpp 2010-11-17 21:47:05 UTC (rev 54306)
@@ -702,9 +702,12 @@
// Not implemented in SSCI
return s->r_acc;
case 8: { // Dup
- SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
reg_t arrayHandle;
SciArray<reg_t> *dupArray = s->_segMan->allocateArray(&arrayHandle);
+ // This must occur after allocateArray, as inserting a new object
+ // in the heap object list might invalidate this pointer. Also refer
+ // to the same issue in kClone()
+ SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
dupArray->setType(array->getType());
dupArray->setSize(array->getSize());
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