Description

Not a regression.
Tested in:
//UE4/Release-4.26.2 CL15973114 Binary - Reproduced
//UE4/Release-4.27.1 CL17735300 Binary - Reproduced
//UE5/Release-5.0-EarlyAccess CL16682836 Binary - Reproduced

From the user: "Unreal Editor performs a search for [an asset] usage in C++ classes, but during the search it tries to use TArray dangerously, triggering a check failure and a crash."

User's Github pull request: 8509

Steps to Reproduce
  1. Create a new blank c++ project with starter content
  2. In the content browser create a folder named Materials
  3. In the Materials folder create a Material named M_Plastic
  4. Create a new c++ class from the StaticMeshActor class named MyStaticMeshActor
    • Reload all in Visual Studio if prompted
  5. In the header file paste this on the line after GENERATED_BODY()
    private:
    	AMyStaticMeshActor();
    
    	void RefreshMaterials();
    
    protected:
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Appearance")
    	UMaterialInterface* MyMaterial;
    
  6. In the cpp file paste this below the #include "MyStaticMeshActor.h"
    AMyStaticMeshActor::AMyStaticMeshActor()
    {
        static ConstructorHelpers::FObjectFinder<UMaterialInterface> plasticFinder(TEXT("Material'/Game/Materials/M_Plastic.M_Plastic'"));
        MyMaterial = plasticFinder.Object;
    
        RefreshMaterials();
    }
    
    void AMyStaticMeshActor::RefreshMaterials()
    {
        UStaticMeshComponent* staticMeshComponent = GetStaticMeshComponent();
        check(staticMeshComponent);
        if (staticMeshComponent && MyMaterial)
            staticMeshComponent->SetMaterial(0, MyMaterial);
    }
    
  7. Save all; then compile in the Editor
  8. Drag the StaticMeshActor you created into the level, and assign MaterialSphere to its Static Mesh
    • It should have M_Plastic assigned for Element 0 and My Material
  9. Navigate to M_Plastic and rename to anything else

Expected Results:
A warning message about renaming an asset that is used by CDO should occur, allowing user to rename/move that asset.

Actual Results:
Crash occurs due to the assertion failure inside the FAssetRenameManager::FindCDOReferencedAssets() => TArray::Remove() => CheckAddress();

Callstack
ntdll!7ffd2ade0000  + 9c144
KERNELBASE!7ffd27ef0000  + 38ba3
UE4Editor-Core!ReportCrash(_EXCEPTION_POINTERS *) [WindowsPlatformCrashContext.cpp:1591]
UE4Editor!7ff64a090000  + 3b7ff
VCRUNTIME140!7ffd0a1c0000  + ecf0
ntdll!7ffd2ade0000  + a11ff
ntdll!7ffd2ade0000  + 6a289
ntdll!7ffd2ade0000  + 6a043
KERNELBASE!7ffd27ef0000  + 3a839
UE4Editor-Core!ReportAssert(wchar_t const *,int) [WindowsPlatformCrashContext.cpp:1644]
UE4Editor-Core!FWindowsErrorOutputDevice::Serialize(wchar_t const *,ELogVerbosity::Type,FName const &) [WindowsErrorOutputDevice.cpp:78]
UE4Editor-Core!FOutputDevice::LogfImpl(wchar_t const *,...) [OutputDevice.cpp:61]
UE4Editor-Core!static void AssertFailedImplV(const char *, const char *, int, const wchar_t *, char *) [AssertionMacros.cpp:104]
UE4Editor-Core!FDebug::CheckVerifyFailedImpl(char const *,char const *,int,wchar_t const *,...) [AssertionMacros.cpp:461]
UE4Editor-AssetTools!DispatchCheckVerify<void,<lambda_53e648ef5d176b5dbe96459ec28ddb4c> >(<lambda_53e648ef5d176b5dbe96459ec28ddb4c> &&) [AssertionMacros.h:165]
UE4Editor-AssetTools!FAssetRenameManager::FindCDOReferencedAssets(TArray<FAssetRenameDataWithReferencers,TSizedDefaultAllocator<32> > const &) [AssetRenameManager.cpp:502]
UE4Editor-AssetTools!FAssetRenameManager::FixReferencesAndRename(TArray<FAssetRenameData,TSizedDefaultAllocator<32> > const &,bool,bool) [AssetRenameManager.cpp:367]
UE4Editor-AssetTools!FAssetRenameManager::RenameAssetsWithDialog(TArray<FAssetRenameData,TSizedDefaultAllocator<32> > const &,bool) [AssetRenameManager.cpp:268]
UE4Editor-ContentBrowserAssetDataSource!ContentBrowserAssetData::RenameAssetFileItem(IAssetTools *,FContentBrowserAssetFileItemDataPayload const &,FString const &) [ContentBrowserAssetDataCore.cpp:790]
UE4Editor-ContentBrowserAssetDataSource!ContentBrowserAssetData::RenameItem(IAssetTools *,IAssetRegistry *,UContentBrowserDataSource const *,FContentBrowserItemData const &,FString const &) [ContentBrowserAssetDataCore.cpp:755]
UE4Editor-ContentBrowserAssetDataSource!UContentBrowserAssetDataSource::RenameItem(FContentBrowserItemData const &,FString const &,FContentBrowserItemData &) [ContentBrowserAssetDataSource.cpp:1135]
UE4Editor-ContentBrowserData!FContentBrowserItem::Rename(FString const &,FContentBrowserItem *) [ContentBrowserItem.cpp:480]
UE4Editor-ContentBrowser!SAssetView::AssetRenameCommit(TSharedPtr<FAssetViewItem,0> const &,FString const &,FSlateRect const &,ETextCommit::Type) [SAssetView.cpp:3640]
UE4Editor-ContentBrowser!bool TBaseSPMethodDelegateInstance<0,SAssetView,0,void __cdecl(TSharedPtr<FAssetViewItem,0> const &,FString const &,FSlateRect const &,enum ETextCommit::Type) [DelegateInstancesImpl.h:307]
UE4Editor-ContentBrowser!SAssetViewItem::HandleNameCommitted(FText const &,ETextCommit::Type) [AssetViewWidgets.cpp:528]
UE4Editor-ContentBrowser!bool TBaseSPMethodDelegateInstance<0,SAssetTileItem,0,void __cdecl(FText const &,enum ETextCommit::Type) [DelegateInstancesImpl.h:307]
UE4Editor-Slate!SInlineEditableTextBlock::OnTextBoxCommitted(FText const &,ETextCommit::Type) [SInlineEditableTextBlock.cpp:323]
UE4Editor-Slate!bool TBaseSPMethodDelegateInstance<0,SInlineEditableTextBlock,0,void __cdecl(FText const &,enum ETextCommit::Type) [DelegateInstancesImpl.h:307]
UE4Editor-Slate!SEditableTextBox::OnEditableTextCommitted(FText const &,ETextCommit::Type) [SEditableTextBox.cpp:482]
UE4Editor-Slate!bool TBaseSPMethodDelegateInstance<0,SEditableTextBox,0,void __cdecl(FText const &,enum ETextCommit::Type) [DelegateInstancesImpl.h:307]
UE4Editor-Slate!FSlateEditableTextLayout::HandleCarriageReturn(bool) [SlateEditableTextLayout.cpp:1519]
UE4Editor-Slate!FSlateEditableTextLayout::HandleKeyDown(FKeyEvent const &) [SlateEditableTextLayout.cpp:967]
UE4Editor-Slate!SEditableText::OnKeyDown(FGeometry const &,FKeyEvent const &) [SEditableText.cpp:212]
UE4Editor-Slate!static class FReply FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FKeyEvent,<lambda_f630e7f24dbef73857a69219e32f2d96> >(class FSlateApplication *, class FEventRouter::FBubblePolicy, struct FKeyEvent, const class FSlateApplication::ProcessKeyDownEvent::__l28::<lambda_f630e7f24dbef73857a69219e32f2d96> & const, ESlateDebuggingInputEvent) [SlateApplication.cpp:383]
UE4Editor-Slate!FSlateApplication::ProcessKeyDownEvent(FKeyEvent const &) [SlateApplication.cpp:4341]
UE4Editor-Slate!FSlateApplication::OnKeyDown(int,unsigned int,bool) [SlateApplication.cpp:4238]
UE4Editor-ApplicationCore!FWindowsApplication::ProcessDeferredMessage(FDeferredWindowsMessage const &) [WindowsApplication.cpp:2040]
UE4Editor-ApplicationCore!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> &,HWND__ *,unsigned int,unsigned __int64,__int64,int,int,unsigned int) [WindowsApplication.cpp:2698]
UE4Editor-ApplicationCore!FWindowsApplication::ProcessMessage(HWND__ *,unsigned int,unsigned __int64,__int64) [WindowsApplication.cpp:1881]
UE4Editor-ApplicationCore!FWindowsApplication::AppWndProc(HWND__ *,unsigned int,unsigned __int64,__int64) [WindowsApplication.cpp:905]
USER32!7ffd2a3c0000  + 163ed
USER32!7ffd2a3c0000  + 15de2
UE4Editor-ApplicationCore!FWindowsPlatformApplicationMisc::PumpMessages(bool) [WindowsPlatformApplicationMisc.cpp:125]
UE4Editor!7ff64a090000  + 7621
UE4Editor!7ff64a090000  + 20fbc
UE4Editor!7ff64a090000  + 210aa
UE4Editor!7ff64a090000  + 240cd

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentUE - Foundation - Core - UObject
Affects Versions4.27.15.0
Target Fix5.0
Fix Commit15475421
Main Commit15475421
CreatedNov 23, 2021
ResolvedDec 13, 2021
UpdatedApr 27, 2022
View Jira Issue