X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Ftexture-manager-impl.cpp;h=71385e2c59cc0cf318851de9e8531c6d94e876a1;hp=b34b9f136a733e1761b0b77490f4bfb834c9c41a;hb=0f3af5aa90602ae60079d11615d8de0765084afe;hpb=f00334715a31692c0bfd7eb0a7fc67c5ae09f327 diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.cpp b/dali-toolkit/internal/visuals/texture-manager-impl.cpp index b34b9f1..71385e2 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.cpp +++ b/dali-toolkit/internal/visuals/texture-manager-impl.cpp @@ -1016,6 +1016,12 @@ void TextureManager::NotifyObservers( TextureInfo& textureInfo, bool success ) 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 ); @@ -1026,8 +1032,6 @@ void TextureManager::NotifyObservers( TextureInfo& textureInfo, bool success ) 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) @@ -1035,16 +1039,6 @@ void TextureManager::NotifyObservers( TextureInfo& textureInfo, bool success ) 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;