DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "NotifyObservers() url:%s loadState:%s\n",
textureInfo.url.GetUrl().c_str(), GET_LOAD_STATE_STRING(textureInfo.loadState ) );
+ // It is possible for the observer to be deleted.
+ // Disconnect and remove the observer first.
+ observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
+
+ info->observerList.Erase( info->observerList.begin() );
+
if( info->loadPixelBuffer )
{
observer->LoadComplete( success, info->pixelBuffer, info->url, info->preMultiplied );
info->preMultiplied );
}
- observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
-
// Get the textureInfo from the container again as it may have been invalidated.
int textureInfoIndex = GetCacheIndexFromId( textureId );
if( textureInfoIndex == INVALID_CACHE_INDEX)
break; // texture has been removed - can stop.
}
info = &mTextureInfoContainer[ textureInfoIndex ];
-
- // remove the observer that was just triggered if it's still in the list
- for( TextureInfo::ObserverListType::Iterator j = info->observerList.Begin(); j != info->observerList.End(); ++j )
- {
- if( *j == observer )
- {
- info->observerList.Erase( j );
- break;
- }
- }
}
mQueueLoadFlag = false;