Skip to content

Commit

Permalink
Added segfault fix (#570)
Browse files Browse the repository at this point in the history
Signed-off-by: William Lew <[email protected]>
  • Loading branch information
WilliamLewww authored Feb 28, 2022
1 parent a6170b1 commit 9ad2a50
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ogre/src/OgreRTShaderSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class ignition::rendering::OgreRTShaderSystemPrivate

/// \brief Flag to indicate shadows need to be reapplied
public: bool resetShadows = false;

/// \brief thread that shader system is created in
public: std::thread::id threadId;
};

using namespace ignition;
Expand All @@ -86,12 +89,17 @@ OgreRTShaderSystem::OgreRTShaderSystem()
#else
this->dataPtr->pssmSetup.reset();
#endif

this->dataPtr->threadId = std::this_thread::get_id();
}

//////////////////////////////////////////////////
OgreRTShaderSystem::~OgreRTShaderSystem()
{
this->Fini();
if (std::this_thread::get_id() == this->dataPtr->threadId)
{
this->Fini();
}
}

//////////////////////////////////////////////////
Expand Down

0 comments on commit 9ad2a50

Please sign in to comment.