Hopefully proper fix for #1938 (crash on osx when exiting race).

This commit is contained in:
hiker 2015-02-17 00:14:26 +11:00
parent 93c5d7428f
commit 93fa075471
2 changed files with 8 additions and 10 deletions

View File

@ -72,15 +72,8 @@ namespace video
//! Destructor //! Destructor
~SMaterialLayer() ~SMaterialLayer()
{ {
#ifdef __APPLE__
// Avoid a crash on osx, where one of the ReadOnlyMaterial
// Texture matrices is -1 - for atm unknown reasons - see #1938
if(TextureMatrix != (core::matrix4*)0xffffffff)
#endif
{
MatrixAllocator.destruct(TextureMatrix); MatrixAllocator.destruct(TextureMatrix);
MatrixAllocator.deallocate(TextureMatrix); MatrixAllocator.deallocate(TextureMatrix);
}
} }
//! Assignment operator //! Assignment operator

View File

@ -658,8 +658,11 @@ void KartModel::reset()
// Stop any animations currently being played. // Stop any animations currently being played.
setAnimation(KartModel::AF_DEFAULT); setAnimation(KartModel::AF_DEFAULT);
// Don't force any LOD
((LODNode*)m_kart->getNode())->forceLevelOfDetail(-1); // Don't force any LOD. Non-animated karts are not LOD nodes.
LODNode *lod = dynamic_cast<LODNode*>(m_kart->getNode());
if (lod)
lod->forceLevelOfDetail(-1);
} // reset } // reset
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -670,7 +673,9 @@ void KartModel::reset()
void KartModel::finishedRace() void KartModel::finishedRace()
{ {
// Force the animated model, independent of actual camera distance. // Force the animated model, independent of actual camera distance.
((LODNode*)m_kart->getNode())->forceLevelOfDetail(0); LODNode *lod = dynamic_cast<LODNode*>(m_kart->getNode());
if (lod)
lod->forceLevelOfDetail(0);
} // finishedRace } // finishedRace
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------