GetNameSafe crashes engine

access violation after I used GetNameSafe (I can’t stable repeat it, but in 10% cases this happening).

FName::GetDisplayNameEntry(…) returned nullptr.

Problem entailed after try to get name of destroyed object.

GetNameSafe returns the Object->GetName() while GetName() returns the GetFName().ToString() and ToString calls the ToString(Out) and crashes after.

UE4Editor-Core.dll!FName::ToString()line 856 C++
UE4Editor-CoreUObject.dll!UObjectBaseUtility::GetName()line 345 C++
UE4Editor-sZoneDriver-9541-Win64-DebugGame.dll!GetNameSafe(const UObjectBaseUtility * Object)line 588 C++
UE4Editor-sZoneDriver-9541-Win64-DebugGame.dll!defer::l2::()line 174 C++
UE4Editor-sZoneDriver-9541-Win64-DebugGame.dll!TBaseFunctorDelegateInstance<TTypeWrapper cdecl(void),void (void) >::Execute()line 1127 C++
UE4Editor-Engine.dll!FTimerUnifiedDelegate::Execute()line 41 C++
UE4Editor-Engine.dll!FTimerManager::Tick(float DeltaTime)line 477 C++
UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds)line 1246 C++
UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode)line 1349 C++
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode)line 368 C++
UE4Editor.exe!FEngineLoop::Tick()line 2775 C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE
* hInInstance, HINSTANCE
* hPrevInstance, int nCmdShow)line 148 C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow)line 189 C++

Hey -

Can you provide the log file from the crash as well? Additionally, where are you making the call to GetNameSafe? Can you provide the code where you’re making this call as well as steps to reproduce the crash so that I can test the issue locally?

defer is callback to future.

defer(GetWorld(), this, 10.f, [=] { /* some actions here */ });

I called it from my code before object will be destroyed. In code of defer used GetNameSafe to check name of object from memory to avoid some troubles (IsValidLowLevel helps, but I noticed, the new UObject created in memory at the same place of old (destroyed) UObject, so I use comparing the names of this objects). Maybe this is not good practice… But in such situatuions this may be raise memory exception…

Rather than calling the defer function when the object is being destroyed, can you try calling it at another point during runtime and let me know if it crashes as well? Also, please include steps to reproduce the crash in a new, clean project to help me investigate the crash locally.

I can’t reproduce error for now… Maybe question can be closed for future…