Fix crash when installing a new kart (#459).

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9982 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-10-14 05:35:37 +00:00
parent 95a42cbb9d
commit ba6094d256

View File

@ -145,8 +145,19 @@ KartModel::~KartModel()
m_wheel_node[i]->drop(); m_wheel_node[i]->drop();
} }
if(m_is_master && m_wheel_model[i]) // For now don't drop the textures: note that the mesh is not
irr_driver->dropAllTextures(m_wheel_model[i]); // dropped either (which enables a reload of kart_properties
// without reading the full mesh again when a new addon is
// installed, see KartPropertiesManager::reLoadAllKarts).
// Therefore if the textures are dropped here, the mesh would
// reference a freed texture, causing a crash.
// While this potentially causes a memory leak, this is not
// important since all kart meshes and all textures they use
// are around till the very end of STK. The textures stay in
// irrlicht's texture cache, and will be freed on exit.
//if(m_is_master && m_wheel_model[i])
// irr_driver->dropAllTextures(m_wheel_model[i]);
} }
#ifdef DEBUG #ifdef DEBUG