mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Replaced in Texture Manager raw texture pointer with weak object pointer and removed explicit call to IsValidLowLevel.
This commit is contained in:
parent
d9220ad536
commit
9c181463ce
@ -53,7 +53,7 @@ FTextureManager::FTextureEntry::FTextureEntry(const FName& InName, UTexture2D* I
|
|||||||
Texture->AddToRoot();
|
Texture->AddToRoot();
|
||||||
|
|
||||||
// Create brush and resource handle for input texture.
|
// Create brush and resource handle for input texture.
|
||||||
Brush.SetResourceObject(Texture);
|
Brush.SetResourceObject(InTexture);
|
||||||
ResourceHandle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(Brush);
|
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
|
// Remove texture from root to allow for garbage collection (it might be already invalid if this is application
|
||||||
// shutdown).
|
// shutdown).
|
||||||
if (Texture && Texture->IsValidLowLevel())
|
if (Texture.IsValid())
|
||||||
{
|
{
|
||||||
Texture->RemoveFromRoot();
|
Texture->RemoveFromRoot();
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ private:
|
|||||||
FTextureEntry& operator=(FTextureEntry&&) = delete;
|
FTextureEntry& operator=(FTextureEntry&&) = delete;
|
||||||
|
|
||||||
FName Name = NAME_None;
|
FName Name = NAME_None;
|
||||||
UTexture2D* Texture = nullptr;
|
TWeakObjectPtr<UTexture2D> Texture;
|
||||||
FSlateBrush Brush;
|
FSlateBrush Brush;
|
||||||
FSlateResourceHandle ResourceHandle;
|
FSlateResourceHandle ResourceHandle;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user