From c85736913140a8c65aed7060a4ae2cc4a64bee70 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 29 Sep 2009 19:51:37 +0000 Subject: Fixed Valgrind warnings about invalid memory access. Hopefully without breaking anything, but modifying a data structure while traversing it can be a bit tricky... svn-id: r44469 --- engines/draci/animation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/draci') diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index 01bd9b93a5..90dc7fdf9d 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -449,7 +449,7 @@ void AnimationManager::sortAnimations() { if ((*next)->getZ() < (*cur)->getZ()) { Animation *anim = *next; - _animations.erase(next); + next = _animations.reverse_erase(next); insertAnimation(anim); hasChanged = true; @@ -502,7 +502,7 @@ void AnimationManager::deleteOverlays() { 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 @@ void AnimationManager::deleteAfterIndex(int index) { debugC(3, kDraciAnimationDebugLevel, "Deleting animation %d...", (*it)->getID()); delete *it; - _animations.erase(it); + it = _animations.reverse_erase(it); } } -- cgit v1.2.3