Applied Wardje's patch for #611, thanks!

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11104 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-04-09 23:38:42 +00:00
parent b210ea2ea0
commit c4bfafeaff

View File

@ -25,6 +25,20 @@ AbstractKartAnimation::AbstractKartAnimation(AbstractKart *kart,
m_timer = 0;
m_kart = kart;
m_name = name;
// Remove previous animation if there is one
#ifndef DEBUG
// Use this code in non-debug mode to avoid a memory leak (and messed
// up animations) if this should happen. In debug mode this condition
// is caught by setKartAnimation(), and useful error messages are
// printed
if (kart->getKartAnimation())
{
AbstractKartAnimation* ka = kart->getKartAnimation();
kart->setKartAnimation(NULL);
delete ka;
}
#endif
// Register this animation with the kart (which will free it
// later).
kart->setKartAnimation(this);