In https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/CoreUObject/Private/UObject/Obj.cpp#L535, I as wondering why the object being destroyed was renamed to None before any sanity check. If there is an error, the sanity check below returns “Trying to call UObject::BeginDestroy from outside of UObject::ConditionalBeginDestroy on object None. Please fix up the calling code.”, which it a bit confusing. Any thought ?
void UObject::BeginDestroy()
{
LowLevelRename(NAME_None);
// Remove from linker's export table.
SetLinker( NULL, INDEX_NONE );
// Sanity assertion to ensure ConditionalBeginDestroy is the only code calling us.
if( !HasAnyFlags(RF_BeginDestroyed) )
{
UE_LOG(LogObj, Fatal,
TEXT("Trying to call UObject::BeginDestroy from outside of UObject::ConditionalBeginDestroy on object %s. Please fix up the calling code."),
*GetName()
);
}