Replaced in Texture Manager raw texture pointer with weak object pointer and removed explicit call to IsValidLowLevel.

This commit is contained in:
Sebastian 2018-08-14 20:40:25 +01:00
parent d9220ad536
commit 9c181463ce
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ FTextureManager::FTextureEntry::FTextureEntry(const FName& InName, UTexture2D* I
Texture->AddToRoot();
// Create brush and resource handle for input texture.
Brush.SetResourceObject(Texture);
Brush.SetResourceObject(InTexture);
ResourceHandle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(Brush);
}
@ -67,7 +67,7 @@ FTextureManager::FTextureEntry::~FTextureEntry()
// Remove texture from root to allow for garbage collection (it might be already invalid if this is application
// shutdown).
if (Texture && Texture->IsValidLowLevel())
if (Texture.IsValid())
{
Texture->RemoveFromRoot();
}

View File

@ -86,7 +86,7 @@ private:
FTextureEntry& operator=(FTextureEntry&&) = delete;
FName Name = NAME_None;
UTexture2D* Texture = nullptr;
TWeakObjectPtr<UTexture2D> Texture;
FSlateBrush Brush;
FSlateResourceHandle ResourceHandle;
};