[7247] Fixed memory and data lost at dalayed expire/clear of movement generators.

This commit is contained in:
VladimirMangos 2009-02-07 23:37:09 +03:00
parent 30c1b87669
commit 6b381f2d0e
2 changed files with 7 additions and 3 deletions

View file

@ -136,7 +136,9 @@ MotionMaster::DelayedClean()
if (empty() || size() == 1) if (empty() || size() == 1)
return; return;
if(!m_expList)
m_expList = new ExpireList(); m_expList = new ExpireList();
while( !empty() && size() > 1 ) while( !empty() && size() > 1 )
{ {
MovementGenerator *curr = top(); MovementGenerator *curr = top();
@ -184,10 +186,12 @@ MotionMaster::DelayedExpire()
curr->Finalize(*i_owner); curr->Finalize(*i_owner);
pop(); pop();
if(!m_expList)
m_expList = new ExpireList();
if( !isStatic(curr) ) if( !isStatic(curr) )
m_expList->push_back(curr); m_expList->push_back(curr);
m_expList = new ExpireList();
while( !empty() && top()->GetMovementGeneratorType() == TARGETED_MOTION_TYPE ) while( !empty() && top()->GetMovementGeneratorType() == TARGETED_MOTION_TYPE )
{ {
// Should check if target is still valid? If not valid it will crash. // Should check if target is still valid? If not valid it will crash.

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7246" #define REVISION_NR "7247"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__