Crash in UWorldFolders::RebuildListInternal when saving pli

Editing a PLI via the inplace edit (ctrl + E) which contains folders results in a crash when saving the edit. It stems from https://github.com/EpicGames/UnrealEngine/blob/dbd4567bb1443f0155e8df4c6118d02f361f73f3/Engine/Source/Editor/UnrealEd/Private/WorldFolders.cpp#L74

void UWorldFolders::RebuildListInternal()
{
	TRACE_CPUPROFILER_EVENT_SCOPE(UWorldFolders::RebuildList);
 
	if (GetWorld()->IsGameWorld())
	{
		 return;
	}

Where the GetWorld() call isn’t validated. Additionally the `UWorldFolders::GetWorld()` function isn’t marked as virtual or override.

0x00007ffbbd16c9f0 UnrealEditor-Engine.dll!UWorld::IsGameWorld() []
0x00007ffc0af48b2c UnrealEditor-UnrealEd.dll!UWorldFolders::RebuildListInternal() []
0x00007ffbbcff5115 UnrealEditor-Engine.dll!FTimerUnifiedDelegate::Execute() []
0x00007ffbbd021b53 UnrealEditor-Engine.dll!FTimerManager::Tick() []
0x00007ffc0a314958 UnrealEditor-UnrealEd.dll!UEditorEngine::Tick() []
0x00007ffc0ae69186 UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick() []
0x00007ff7507a5076 UnrealEditor.exe!FEngineLoop::Tick() []
0x00007ff7507c0bfe UnrealEditor.exe!GuardedMain() []
0x00007ff7507c0d0a UnrealEditor.exe!GuardedMainWrapper() []
0x00007ff7507c4590 UnrealEditor.exe!LaunchWindowsStartup() []
0x00007ff7507d5be4 UnrealEditor.exe!WinMain() []
0x00007ff7507d8f9a UnrealEditor.exe!__scrt_common_main_seh() []
0x00007ffc8085259d KERNEL32.DLL!UnknownFunction []

[Attachment Removed]

Hi Brian,

We haven’t been able to reproduce the problem with the information you shared. Can you provide a sample project that demonstrate the problem or precise instructions?

Regards,

Martin

[Attachment Removed]

Hi Martin, it does seem some what fickle to reproduce. I poked it for a few minutes this afternoon and didn’t find a reliable way to trigger it. It needs to trigger a list rebuild while a level is streaming: That IsInBlock must return true.

void UWorldFolders::RebuildList()
{
	if (GetWorld()->GetIsInBlockTillLevelStreamingCompleted())
	{

This is what the editor looked like when it reproed [Image Removed]I’ve got a level placed in the world, and a PLI version of that same level placed.

I had just clicked ‘save’ on the PLI.

It’s not very consistent though, sometimes it works with just a single level instance, other times the PLI seems to be needed.

The logical flaw with the code in question is that it’s `GetWorld()` is a weak pointer and is no longer valid by the time RebuildList is invoked on the next frame. [Image Removed]

[Attachment Removed]

Thanks for the extra information. That should help reproducing the problem. We would like to be able to understand why this is happening and avoid to slap a guard on the validity of the weak pointer if possible.

[Attachment Removed]

Hello!

After review of the code, adding a validity test on the World weak pointer would be the proper way to resolve the crash.

void UWorldFolders::RebuildListInternal()
{
	TRACE_CPUPROFILER_EVENT_SCOPE(UWorldFolders::RebuildList);
 
	if (World.IsValid() && GetWorld()->IsGameWorld())
	{
		return;
	}

Regards,

Martin

[Attachment Removed]