Fixed #457: crash after battle mode. Texture ref counting was not done

correctly, resulting in wheel textures to be freed even though the
textures were still used (in the master kart models).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9964 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2011-10-10 05:41:55 +00:00
parent 5993f32f30
commit 2a227e9d8b

View File

@@ -136,14 +136,17 @@ KartModel::~KartModel()
m_animated_node->drop();
}
for(unsigned int i=0; i<4; i++)
for(unsigned int i=0; i<4; i++)
{
if(m_wheel_node[i])
{
// Master KartModels should never have a wheel attached.
assert(!m_is_master);
m_wheel_node[i]->drop();
}
if(m_is_master && m_wheel_model[i])
irr_driver->dropAllTextures(m_wheel_model[i]);
}
#ifdef DEBUG
@@ -313,7 +316,10 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
std::string full_wheel =
kart_properties.getKartDir()+"/"+m_wheel_filename[i];
m_wheel_model[i] = irr_driver->getMesh(full_wheel);
// FIXME: wheel handling still missing.
// Grab all textures. This is done for the master only, so
// the destructor will only free the textures if a master
// copy is freed.
irr_driver->grabAllTextures(m_wheel_model[i]);
} // for i<4
return true;