[Scummvm-cvs-logs] SF.net SVN: scummvm: [32744] scummvm/trunk/engines/parallaction/ parallaction.cpp
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Jun 22 07:42:22 CEST 2008
Revision: 32744
http://scummvm.svn.sourceforge.net/scummvm/?rev=32744&view=rev
Author: peres001
Date: 2008-06-21 22:42:22 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
Circular references between Zone/Animation and Command are now manually removed, to allow the objects - which are stored into SharedPtr's - to be deallocated.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/parallaction.cpp
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2008-06-21 16:17:38 UTC (rev 32743)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2008-06-22 05:42:22 UTC (rev 32744)
@@ -86,7 +86,7 @@
Parallaction::~Parallaction() {
clearSet(_commandOpcodes);
clearSet(_instructionOpcodes);
-
+
delete _debugger;
delete _globalTable;
delete _callableNames;
@@ -95,7 +95,7 @@
freeCharacter();
destroyInventory();
-
+
delete _localFlagNames;
delete _gfx;
delete _soundMan;
@@ -193,6 +193,9 @@
}
void Parallaction::freeAnimations() {
+ for (AnimationList::iterator it = _location._animations.begin(); it != _location._animations.end(); it++) {
+ (*it)->_commands.clear(); // See comment for freeZones(), about circular references.
+ }
_location._animations.clear();
return;
}
@@ -479,6 +482,9 @@
debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name);
it++;
} else {
+ (*it)->_commands.clear(); // Since commands may reference zones, and both commands and zones are kept stored into
+ // SharedPtr's, we need to kill commands explicitly to destroy any potential circular
+ // reference.
it = _location._zones.erase(it);
}
}
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