Skip to content

Commit

Permalink
Fix MeshShape::clear() for safer mesh removal (#3164) (#3167)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Wang <[email protected]>
  • Loading branch information
mergify[bot] and scmwang authored Dec 16, 2024
1 parent e94c891 commit ccc75f1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ void MeshShape::clear()
if (entity_)
{
entity_->detachFromParent();
Ogre::MeshManager::getSingleton().remove(entity_->getMesh()->getName());
const auto& mesh_name = entity_->getMesh()->getName();
if (Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().getByName(mesh_name))
{
Ogre::MeshManager::getSingleton().remove(mesh);
}
scene_manager_->destroyEntity(entity_);
entity_ = nullptr;
}
Expand Down

0 comments on commit ccc75f1

Please sign in to comment.