Skip to content

Commit

Permalink
Fix memory corruption with shared wheel and headlight, see #5240
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Jan 12, 2025
1 parent 86bbcd1 commit f8c6c66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/karts/kart_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ KartModel::~KartModel()
if(m_is_master && m_wheel_model[i])
{
irr_driver->dropAllTextures(m_wheel_model[i]);
irr_driver->removeMeshFromCache(m_wheel_model[i]);
if (m_wheel_model[i]->getReferenceCount() == 1)
irr_driver->removeMeshFromCache(m_wheel_model[i]);
}
}

Expand Down

0 comments on commit f8c6c66

Please sign in to comment.