Bugfix: STK would crash if the same kart mesh is used twice (e.g. when

just copying a kart folder). Thanks to funto for reporting this.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12499 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-02-17 11:26:52 +00:00
parent 903d1da403
commit 3046aaa361

View File

@ -169,7 +169,11 @@ KartModel::~KartModel()
}
}
if(m_is_master && m_mesh != NULL)
m_mesh->drop();
// If there is only one copy left, it's the copy in irrlicht's
// mesh cache, so it can be remove.
if(m_is_master && m_mesh != NULL && m_mesh->getReferenceCount()==1)
{
irr_driver->dropAllTextures(m_mesh);
irr_driver->removeMeshFromCache(m_mesh);
@ -351,6 +355,7 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
full_path.c_str(), kart_properties.getIdent().c_str());
return false;
}
m_mesh->grab();
irr_driver->grabAllTextures(m_mesh);
Vec3 min, max;