[Scummvm-cvs-logs] SF.net SVN: scummvm:[44469] scummvm/trunk/engines/draci/animation.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Tue Sep 29 21:51:37 CEST 2009


Revision: 44469
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44469&view=rev
Author:   eriktorbjorn
Date:     2009-09-29 19:51:37 +0000 (Tue, 29 Sep 2009)

Log Message:
-----------
Fixed Valgrind warnings about invalid memory access. Hopefully without breaking
anything, but modifying a data structure while traversing it can be a bit
tricky...

Modified Paths:
--------------
    scummvm/trunk/engines/draci/animation.cpp

Modified: scummvm/trunk/engines/draci/animation.cpp
===================================================================
--- scummvm/trunk/engines/draci/animation.cpp	2009-09-29 19:51:24 UTC (rev 44468)
+++ scummvm/trunk/engines/draci/animation.cpp	2009-09-29 19:51:37 UTC (rev 44469)
@@ -449,7 +449,7 @@
 			if ((*next)->getZ() < (*cur)->getZ()) {
 
 				Animation *anim = *next;
-				_animations.erase(next);
+				next = _animations.reverse_erase(next);
 
 				insertAnimation(anim);
 				hasChanged = true;
@@ -502,7 +502,7 @@
 	for (it = _animations.begin(); it != _animations.end(); ++it) {
 		if ((*it)->getID() == kOverlayImage) {
 			delete *it;
-			_animations.erase(it);
+			it = _animations.reverse_erase(it);
 		}	
 	}
 }
@@ -536,7 +536,7 @@
 			debugC(3, kDraciAnimationDebugLevel, "Deleting animation %d...", (*it)->getID());
 
 			delete *it;
-			_animations.erase(it);
+			it = _animations.reverse_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