I have a class memeber variable of TSharedPtr type, I try to re-assign this memeber variable to record last changes:
if(m_LastCaptureTex.IsValid()){
UE_LOG(LogTemp, Warning, TEXT("m_LastCaptureTex.GetSharedReferenceCount: %d"), m_LastCaptureTex.GetSharedReferenceCount());
m_LastCaptureTex->ReleaseResource();
m_LastCaptureTex.Reset();
m_LastCaptureTex=nullptr;
}
m_LastCaptureTex=MakeShareable(NewTexture);
But the second time will trigger an expection says:
"Fatal error: [File:UnrealEngine\Engine\Source\Runtime\RenderCore\Private\RenderResource.cpp] [Line: 322] A FRenderResource was deleted without being released first!
"
How to solve this? Thanks in advance.