Editor crash when mesh used as folige is deleted

Editor crashes when trying to open a level with a terrain that uses a foliage mesh that was previously deleted (force deleted). It does not occur if the mesh is deleted while the level using it is open.

I have tested 4.16.preview3 and compiling branch 4.16 (20 May 2017) from Github. Crash does not occur on version 4.15.2. OS is Windows 10.

Steps to reproduce:

    1. Create blank project with starter content
    1. Create new Level and open it
    1. Create Landscape and paint any mesh as foliage
    1. Save all and open a different level
    1. Delete mesh used as foliage (Don’t replace)
    1. Try to reopen previous level

CallStack is similar as in issue UE-44126 but described commit doesn’t seem to fix this issue.

Access violation - code c0000005 (first/second chance not available)

UE4Editor_Foliage!FMulticastDelegateBase<FWeakObjectPtr>::RemoveAll() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\multicastdelegatebase.h:81]
UE4Editor_Foliage!AInstancedFoliageActor::RemoveFoliageType() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\foliage\private\instancedfoliage.cpp:2094]
UE4Editor_Foliage!AInstancedFoliageActor::PostLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\foliage\private\instancedfoliage.cpp:2622]
UE4Editor_CoreUObject!UObject::ConditionalPostLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:952]
UE4Editor_CoreUObject!UObject::PostLoadSubobjects() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:985]
UE4Editor_CoreUObject!UObject::ConditionalPostLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:941]
UE4Editor_CoreUObject!EndLoad() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1535]
UE4Editor_CoreUObject!LoadPackageInternal() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1289]
UE4Editor_CoreUObject!LoadPackage() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1377]
UE4Editor_CoreUObject!ResolveName() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:778]
UE4Editor_CoreUObject!StaticLoadObjectInternal() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:865]
UE4Editor_CoreUObject!StaticLoadObject() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:929]
UE4Editor_ContentBrowser!FAssetData::GetAsset() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\assetregistry\public\assetdata.h:250]
UE4Editor_ContentBrowser!SContentBrowser::OnAssetsActivated() [d:\build\++ue4+release-4.16+compile\sync\engine\source\editor\contentbrowser\private\scontentbrowser.cpp:1873]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SContentBrowser,0,TTypeWrapper<void> __cdecl(TArray<FAssetData,FDefaultAllocator> const & __ptr64,enum EAssetTypeActivationMethod::Type)>::Execute() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:327]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SContentBrowser,0,void __cdecl(TArray<FAssetData,FDefaultAllocator> const & __ptr64,enum EAssetTypeActivationMethod::Type)>::ExecuteIfSafe() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:434]
UE4Editor_ContentBrowser!TBaseDelegate<void,TArray<FAssetData,FDefaultAllocator> const & __ptr64,enum EAssetTypeActivationMethod::Type>::ExecuteIfBound() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:624]
UE4Editor_ContentBrowser!SAssetView::OnListMouseButtonDoubleClick() [d:\build\++ue4+release-4.16+compile\sync\engine\source\editor\contentbrowser\private\sassetview.cpp:3755]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SAssetView,0,TTypeWrapper<void> __cdecl(TSharedPtr<FAssetViewItem,0>)>::Execute() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:327]
UE4Editor_ContentBrowser!TBaseSPMethodDelegateInstance<0,SAssetView,0,void __cdecl(TSharedPtr<FAssetViewItem,0>)>::ExecuteIfSafe() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:434]
UE4Editor_ContentBrowser!TBaseDelegate<void,TSharedPtr<FAssetViewItem,0> >::ExecuteIfBound() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:624]
UE4Editor_ContentBrowser!SListView<TSharedPtr<FAssetViewItem,0> >::Private_OnItemDoubleClicked() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\slate\public\widgets\views\slistview.h:815]
UE4Editor_ContentBrowser!STableRow<TSharedPtr<FAssetViewItem,0> >::OnMouseButtonDoubleClick() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\slate\public\widgets\views\stablerow.h:290]
UE4Editor_Slate!<lambda_eeb33fd1b480e3cad58a1531d90d2e14>::operator()() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:5460]
UE4Editor_Slate!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FPointerEvent,<lambda_eeb33fd1b480e3cad58a1531d90d2e14> >() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:239]
UE4Editor_Slate!FSlateApplication::RoutePointerDoubleClickEvent() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:5458]
UE4Editor_Slate!FSlateApplication::ProcessMouseButtonDoubleClickEvent() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:5441]
UE4Editor_Slate!FSlateApplication::OnMouseDoubleClick() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:5419]
UE4Editor_Core!FWindowsApplication::ProcessDeferredMessage() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsapplication.cpp:1708]
UE4Editor_Core!FWindowsApplication::DeferMessage() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsapplication.cpp:2127]
UE4Editor_Core!FWindowsApplication::ProcessMessage() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsapplication.cpp:867]
UE4Editor_Core!FWindowsApplication::AppWndProc() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsapplication.cpp:714]
user32
user32
UE4Editor_Core!FWindowsPlatformMisc::PumpMessages() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsplatformmisc.cpp:980]
UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3058]
UE4Editor!GuardedMain() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\launch.cpp:166]
UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
UE4Editor!WinMain() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll

Sorry for the bump. I just saw that an Issue (UE-45562) was opened that matches this crash but is lacking information and repro steps. I hope this helps to solve it.

I was able to fix the bug locally by compiling the editor with a single line commented but I wasn’t sure if I should have made a commit to the repository before it was internally registered as an issue. Additionally, I left a comment in Github on the commit that introduced this bug.

Hi jomaceld.

Thank you for the clear repro steps. I have reproduced the issue, and updated UE-45562 with this information.

Regarding committing a fix to Github, you are certainly welcome to at any time. Although hopefully we are able to resolve this soon now that we have the reproduction steps in hand.

Edit: This has been fixed for 4.16.2

Cheers!