Description

A world leak crash occurs when using NewLevelFromTemplate to duplicate a sublevel of the currently loaded level. The crash doesn't manifest until another level is loaded even though the Sublevel instance leaked at the time when the new level was created, likely since a copy is being created and won't detect itself as a leak. Log shows the following:

[2021.02.23-02.25.40:299][304]LogReferenceChain: (standalone) World /Game/Maps/MySublevel.MySublevel is not currently reachable.
[2021.02.23-02.25.40:299][304]LogEditorServer: Error: Old world /Game/Maps/MySublevel.MySublevel not cleaned up by garbage collection while loading new map! Referenced by:
(standalone) World /Game/Maps/MySublevel.MySublevel is not currently reachable.

As a workaround we can load some other map (so that the sublevel is unloaded), and then do the duplication

Steps to Reproduce
  1. Create two maps, OuterLevel and SubLevel. Add SubLevel as a sub level to OuterLevel
  2. Create an editor utility widget with a button that calls New Level From Template. Pass the path to SubLevel as the template, and provide any location for the new level to be saved
  3. Click the button to create the new level, note that the level is automatically loaded in the level editor
  4. Open any other level, crash occurs
Callstack
> [Inline Frame] UE4Editor-UnrealEd.dll!UEditorEngine::CheckForWorldGCLeaks::__l37::<lambda_a50c050c79f8b9c596c3d4f154719893>::()::__l6::<lambda_5b0a92409f9883aee768fd32ebea1300>::operator()() Line 2020 C++> [Inline Frame] UE4Editor-UnrealEd.dll!UEditorEngine::CheckForWorldGCLeaks::__l37::<lambda_a50c050c79f8b9c596c3d4f154719893>::()::__l6::<lambda_5b0a92409f9883aee768fd32ebea1300>::operator()() Line 2020 C++  [Inline Frame] UE4Editor-UnrealEd.dll!UEditorEngine::CheckForWorldGCLeaks::__l37::<lambda_a50c050c79f8b9c596c3d4f154719893>::operator()(const FLogCategoryLogEditorServer &) Line 2020 C++  UE4Editor-UnrealEd.dll!UEditorEngine::CheckForWorldGCLeaks(UWorld * NewWorld, UPackage * WorldPackage) Line 2020 C++  UE4Editor-UnrealEd.dll!UEditorEngine::EditorDestroyWorld(FWorldContext & Context, const FText & CleanseText, UWorld * NewWorld) Line 2174 C++  UE4Editor-UnrealEd.dll!UEditorEngine::Map_Load(const wchar_t * Str, FOutputDevice & Ar) Line 2575 C++  UE4Editor-UnrealEd.dll!UEditorEngine::HandleMapCommand(const wchar_t * Str, FOutputDevice & Ar, UWorld * InWorld) Line 6207 C++  UE4Editor-UnrealEd.dll!UEditorEngine::Exec(UWorld * InWorld, const wchar_t * Stream, FOutputDevice & Ar) Line 5708 C++  UE4Editor-UnrealEd.dll!UUnrealEdEngine::Exec(UWorld * InWorld, const wchar_t * Stream, FOutputDevice & Ar) Line 697 C++  UE4Editor-UnrealEd.dll!FEditorFileUtils::LoadMap(const FString & InFilename, bool LoadAsTemplate, const bool bShowProgress) Line 2554 C++  UE4Editor-AssetTools.dll!FAssetTypeActions_World::OpenAssetEditor(const TArray<UObject *,TSizedDefaultAllocator<32>> & InObjects, TSharedPtr<IToolkitHost,0> EditWithinLevelEditor) Line 20 C++  UE4Editor-UnrealEd.dll!UAssetEditorSubsystem::OpenEditorForAsset(UObject * Asset, const EToolkitMode::Type ToolkitMode, TSharedPtr<IToolkitHost,0> OpenedFromLevelEditor, const bool bShowProgressWindow) Line 363 C++  UE4Editor-UnrealEd.dll!UAssetEditorSubsystem::OpenEditorForAssets_Advanced(const TArray<UObject *,TSizedDefaultAllocator<32>> & InAssets, const EToolkitMode::Type ToolkitMode, TSharedPtr<IToolkitHost,0> OpenedFromLevelEditor) Line 437 C++  UE4Editor-UnrealEd.dll!UAssetEditorSubsystem::OpenEditorForAssets(const TArray<UObject *,TSizedDefaultAllocator<32>> & Assets) Line 553 C++  UE4Editor-ContentBrowserAssetDataSource.dll!ContentBrowserAssetData::EditOrPreviewAssetFileItems(TArrayView<TSharedRef<FContentBrowserAssetFileItemDataPayload const ,0> const ,int> InAssetPayloads, const bool bIsPreview) Line 287 C++  UE4Editor-ContentBrowserAssetDataSource.dll!ContentBrowserAssetData::EditOrPreviewItems(IAssetTools * InAssetTools, const UContentBrowserDataSource * InOwnerDataSource, TArrayView<FContentBrowserItemData const ,int> InItems, const bool bIsPreview) Line 307 C++  [Inline Frame] UE4Editor-ContentBrowserAssetDataSource.dll!ContentBrowserAssetData::EditItems(IAssetTools * InAssetTools, const UContentBrowserDataSource *) Line 312 C++  UE4Editor-ContentBrowserAssetDataSource.dll!UContentBrowserAssetDataSource::BulkEditItems(TArrayView<FContentBrowserItemData const ,int> InItems) Line 1030 C++  UE4Editor-ContentBrowser.dll!SContentBrowser::OnItemsActivated(TArrayView<FContentBrowserItem const ,int> ActivatedItems, EAssetTypeActivationMethod::Type ActivationMethod) Line 2280 C++  [Inline Frame] UE4Editor-ContentBrowser.dll!Invoke(void(SContentBrowser::*)(TArrayView<FContentBrowserItem const ,int>, EAssetTypeActivationMethod::Type)) Line 65 C++  [Inline Frame] UE4Editor-ContentBrowser.dll!UE4Tuple_Private::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(void(SContentBrowser::*)(TArrayView<FContentBrowserItem const ,int>, EAssetTypeActivationMethod::Type) &) Line 306 C++  UE4Editor-ContentBrowser.dll!TBaseSPMethodDelegateInstance<0,SContentBrowser,0,void __cdecl(TArrayView<FContentBrowserItem const ,int>,enum EAssetTypeActivationMethod::Type),FDefaultDelegateUserPolicy>::Execute(TArrayView<FContentBrowserItem const ,int> <Params_0>, EAssetTypeActivationMethod::Type <Params_1>) Line 290 C++  [Inline Frame] UE4Editor-ContentBrowser.dll!TDelegate<void __cdecl(TArrayView<FContentBrowserItem const ,int>,enum EAssetTypeActivationMethod::Type),FDefaultDelegateUserPolicy>::Execute(TArrayView<FContentBrowserItem const ,int>) Line 580 C++  UE4Editor-ContentBrowser.dll!SAssetView::OnListMouseButtonDoubleClick(TSharedPtr<FAssetViewItem,0> AssetItem) Line 3548 C++  [Inline Frame] UE4Editor-ContentBrowser.dll!Invoke(void(SAssetView::*)(TSharedPtr<FAssetViewItem,0>)) Line 65 C++  [Inline Frame] UE4Editor-ContentBrowser.dll!UE4Tuple_Private::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(void(SAssetView::*)(TSharedPtr<FAssetViewItem,0>) &) Line 306 C++  UE4Editor-ContentBrowser.dll!TBaseSPMethodDelegateInstance<0,SAssetView,0,void __cdecl(TSharedPtr<FAssetViewItem,0>),FDefaultDelegateUserPolicy>::ExecuteIfSafe(TSharedPtr<FAssetViewItem,0> <Params_0>) Line 307 C++  UE4Editor-ContentBrowser.dll!TDelegate<void __cdecl(TSharedPtr<FAssetViewItem,0>),FDefaultDelegateUserPolicy>::ExecuteIfBound<void,0>(TSharedPtr<FAssetViewItem,0> <Params_0>) Line 599 C++  UE4Editor-ContentBrowser.dll!SListView<TSharedPtr<FAssetViewItem,0>>::Private_OnItemDoubleClicked(TSharedPtr<FAssetViewItem,0> TheItem) Line 1074 C++  UE4Editor-ContentBrowser.dll!STableRow<TSharedPtr<FAssetViewItem,0>>::OnMouseButtonDoubleClick(const FGeometry & InMyGeometry, const FPointerEvent & InMouseEvent) Line 461 C++  [Inline Frame] UE4Editor-Slate.dll!FSlateApplication::RoutePointerDoubleClickEvent::__l2::<lambda_2b5148752c2a272000c47b69ff14a42e>::operator()(const FArrangedWidget &) Line 5293 C++  UE4Editor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FPointerEvent,<lambda_2b5148752c2a272000c47b69ff14a42e>>(FSlateApplication * ThisApplication, FEventRouter::FBubblePolicy RoutingPolicy, FPointerEvent EventCopy, const FSlateApplication::RoutePointerDoubleClickEvent::__l2::<lambda_2b5148752c2a272000c47b69ff14a42e> & Lambda, ESlateDebuggingInputEvent DebuggingInputEvent) Line 378 C++  UE4Editor-Slate.dll!FSlateApplication::RoutePointerDoubleClickEvent(const FWidgetPath & WidgetsUnderPointer, const FPointerEvent & PointerEvent) Line 5291 C++  UE4Editor-Slate.dll!FSlateApplication::ProcessMouseButtonDoubleClickEvent(const TSharedPtr<FGenericWindow,0> & PlatformWindow, const FPointerEvent & InMouseEvent) Line 5278 C++  UE4Editor-Slate.dll!FSlateApplication::OnMouseDoubleClick(const TSharedPtr<FGenericWindow,0> & PlatformWindow, const EMouseButtons::Type Button, const FVector2D CursorPos) Line 5241 C++  UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 2204 C++  UE4Editor-ApplicationCore.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 2693 C++  UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 1876 C++  UE4Editor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 900 C++  [External Code]   [Inline Frame] UE4Editor-ApplicationCore.dll!WinPumpMessages() Line 103 C++  UE4Editor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) Line 125 C++  UE4Editor.exe!FEngineLoop::Tick() Line 4842 C++  [Inline Frame] UE4Editor.exe!EngineTick() Line 62 C++  UE4Editor.exe!GuardedMain(const wchar_t * CmdLine) Line 169 C++  UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 257 C++  [External Code] 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-109253 in the post.

1
Login to Vote

Fixed
ComponentTools
Affects Versions4.264.27
Target Fix4.27
Fix Commit15574854
Main Commit15574854
CreatedFeb 23, 2021
ResolvedMar 2, 2021
UpdatedNov 29, 2022
View Jira Issue