Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small crash fix on shutdown #355

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ogre2/src/Ogre2RenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ void Ogre2RenderEngine::Destroy()
delete this->ogreOverlaySystem;
this->ogreOverlaySystem = nullptr;

// Clean up any textures that may still be in flight.
Ogre::TextureGpuManager *mgr =
if (this->ogreRoot)
{
// Clean up any textures that may still be in flight.
Ogre::TextureGpuManager *mgr =
this->ogreRoot->getRenderSystem()->getTextureGpuManager();
darksylinc marked this conversation as resolved.
Show resolved Hide resolved

auto entries = mgr->getEntries();
for (auto& [name, entry] : entries)
{
if (entry.resourceGroup == "General")
mgr->destroyTexture(entry.texture);
}
auto entries = mgr->getEntries();
for (auto& [name, entry] : entries)
{
if (entry.resourceGroup == "General" && !entry.destroyRequested)
mgr->destroyTexture(entry.texture);
}

if (this->ogreRoot)
{
try
{
// TODO(anyone): do we need to catch segfault on delete?
Expand Down