I found and fixed this bug a while ago, however was reminded of it when upgrading to 1.8.0.
The bug is a crash that can occur in OgreTextureUnitState.cpp in the ensurePrepared and ensureLoaded function.
Repro:
Create a resource group.
Load some resources in it.
Destroy the resource group.
Create a new resource group with a different name.
Load the same set of resources in the new resource group.
The texture unit state will try to load itself even though its original resource group no longer exists, causing a crash.
The solution is to destroy the texture unit state if the resource groups dont match, making the texture unit state get recreated rather than get reloaded.
Here is a patch for the fix:
Code: Select all
diff -r dac6bfcd3327 OgreMain/src/OgreTextureUnitState.cpp
--- a/OgreMain/src/OgreTextureUnitState.cpp Sun Sep 16 20:47:24 2012 -0500
+++ b/OgreMain/src/OgreTextureUnitState.cpp Thu Sep 20 13:43:24 2012 +1000
@@ -1146,6 +1146,9 @@
{
if (!mFrames[frame].empty() && !mTextureLoadFailed)
{
+ if ( !mFramePtrs[frame].isNull() && mParent->getResourceGroup() != mFramePtrs[frame]->getGroup() )
+ mFramePtrs[frame].setNull();
+
// Ensure texture is loaded, specified number of mipmaps and
// priority
if (mFramePtrs[frame].isNull())
@@ -1178,6 +1181,9 @@
{
if (!mFrames[frame].empty() && !mTextureLoadFailed)
{
+ if ( !mFramePtrs[frame].isNull() && mParent->getResourceGroup() != mFramePtrs[frame]->getGroup() )
+ mFramePtrs[frame].setNull();
+
// Ensure texture is loaded, specified number of mipmaps and
// priority
if (mFramePtrs[frame].isNull())
Thanks!!