Description

Deleting the first instanced subobject entry from a default value for a map or set variable can result in accessing an incorrect subobject for the element's value during reinstancing, which can then lead to an editor crash down the line when trying to patch in a mismatched subobject instance.

Note: In a debug build, this situation will be caught a bit earlier by a checkSlow() that fires to validate the element index before accessing it inside the map.

Steps to Reproduce
  1. Open the attached project in the editor.
  2. Open BP_MyGroup.
  3. Delete the first entry from the 'Presentations' value.
  4. Compile, frequently a crash will result.
Callstack
>	UE4Editor-CoreUObject-Win64-Debug.dll!FUObjectAnnotationChunked<FLinkerIndexPair,0,65536>::AllocateAnnotation(int Index) Line 571	C++
 	UE4Editor-CoreUObject-Win64-Debug.dll!FUObjectAnnotationChunked<FLinkerIndexPair,0,65536>::AddAnnotationInternal<FLinkerIndexPair>(int Index, FLinkerIndexPair && Annotation) Line 649	C++
 	UE4Editor-CoreUObject-Win64-Debug.dll!FUObjectAnnotationChunked<FLinkerIndexPair,0,65536>::AddAnnotation(const UObjectBase * Object, FLinkerIndexPair && Annotation) Line 687	C++
 	UE4Editor-CoreUObject-Win64-Debug.dll!UObject::SetLinker(FLinkerLoad * LinkerLoad, int LinkerIndex, bool bShouldDetachExisting) Line 130	C++
 	UE4Editor-CoreUObject-Win64-Debug.dll!FLinkerLoad::PRIVATE_PatchNewObjectIntoExport(UObject * OldObject, UObject * NewObject) Line 573	C++
 	UE4Editor-UnrealEd-Win64-Debug.dll!`FBlueprintEditorUtils::PatchCDOSubobjectsIntoExport'::`5'::PatchCDOSubobjectsIntoExport_Impl::PatchSubObjects(UObject * OldObj, UObject * NewObj) Line 1749	C++
 	UE4Editor-UnrealEd-Win64-Debug.dll!FBlueprintEditorUtils::PatchCDOSubobjectsIntoExport(UObject * PreviousCDO, UObject * NewCDO) Line 1756	C++
 	UE4Editor-UnrealEd-Win64-Debug.dll!FBlueprintEditorUtils::PatchNewCDOIntoLinker(UObject * CDO, FLinkerLoad * Linker, int ExportIndex, FUObjectSerializeContext * InLoadContext) Line 774	C++
 	UE4Editor-Kismet-Win64-Debug.dll!FBlueprintCompilationManagerImpl::ReinstanceBatch(TArray<FReinstancingJob,TSizedDefaultAllocator<32>> & Reinstancers, TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0>> & InOutOldToNewClassMap, FUObjectSerializeContext * InLoadContext) Line 2096	C++
 	UE4Editor-Kismet-Win64-Debug.dll!FBlueprintCompilationManagerImpl::FlushCompilationQueueImpl(bool bSuppressBroadcastCompiled, TArray<UBlueprint *,TSizedDefaultAllocator<32>> * BlueprintsCompiled, TArray<UBlueprint *,TSizedDefaultAllocator<32>> * BlueprintsCompiledOrSkeletonCompiled, FUObjectSerializeContext * InLoadContext) Line 1395	C++
 	UE4Editor-Kismet-Win64-Debug.dll!FBlueprintCompilationManagerImpl::CompileSynchronouslyImpl(const FBPCompileRequestInternal & Request) Line 277	C++
 	UE4Editor-Kismet-Win64-Debug.dll!FBlueprintCompilationManager::CompileSynchronously(const FBPCompileRequest & Request) Line 3090	C++
 	UE4Editor-UnrealEd-Win64-Debug.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, EBlueprintCompileOptions CompileFlags, FCompilerResultsLog * pResults) Line 754	C++
 	UE4Editor-Kismet-Win64-Debug.dll!FBlueprintEditor::Compile() Line 3627	C++
 	UE4Editor-Kismet-Win64-Debug.dll!TBaseSPMethodDelegateInstance<0,FBlueprintEditor,0,void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() Line 309	C++
 	UE4Editor-Slate-Win64-Debug.dll!TDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfBound<void,0>() Line 599	C++
 	UE4Editor-Slate-Win64-Debug.dll!FUICommandList::ExecuteAction(const TSharedRef<FUICommandInfo const ,0> InUICommandInfo) Line 103	C++
 	UE4Editor-Slate-Win64-Debug.dll!SToolBarButtonBlock::OnClicked() Line 301	C++
 	UE4Editor-Slate-Win64-Debug.dll!UE4Tuple_Private::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter<FReply (__cdecl SToolBarButtonBlock::*const &)(void),SToolBarButtonBlock * &>(FReply(SToolBarButtonBlock::*)() & Func, SToolBarButtonBlock * & <Args_0>) Line 299	C++
 	UE4Editor-Slate-Win64-Debug.dll!TBaseSPMethodDelegateInstance<0,SToolBarButtonBlock,0,FReply __cdecl(void),FDefaultDelegateUserPolicy>::Execute() Line 290	C++
 	UE4Editor-Slate-Win64-Debug.dll!SButton::ExecuteOnClick() Line 385	C++
 	UE4Editor-Slate-Win64-Debug.dll!SButton::OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MouseEvent) Line 304	C++
 	UE4Editor-Slate-Win64-Debug.dll!FSlateApplication::RoutePointerUpEvent::__l8::<lambda>(const FArrangedWidget & TargetWidget, const FPointerEvent & Event) Line 4829	C++
 	UE4Editor-Slate-Win64-Debug.dll!FEventRouter::Route<FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,FReply <lambda>(const FArrangedWidget &, const FPointerEvent &)>(FSlateApplication * ThisApplication, FEventRouter::FToLeafmostPolicy RoutingPolicy, FPointerEvent EventCopy, const FSlateApplication::RoutePointerUpEvent::__l8::FReply <lambda>(const FArrangedWidget &, const FPointerEvent &) & Lambda, ESlateDebuggingInputEvent DebuggingInputEvent) Line 378	C++
 	UE4Editor-Slate-Win64-Debug.dll!FSlateApplication::RoutePointerUpEvent(const FWidgetPath & WidgetsUnderPointer, const FPointerEvent & PointerEvent) Line 4815	C++
 	UE4Editor-Slate-Win64-Debug.dll!FSlateApplication::ProcessMouseButtonUpEvent(const FPointerEvent & MouseEvent) Line 5356	C++
 	UE4Editor-Slate-Win64-Debug.dll!FSlateApplication::OnMouseUp(const EMouseButtons::Type Button, const FVector2D CursorPos) Line 5321	C++
 	UE4Editor-ApplicationCore-Win64-Debug.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 2178	C++
 	UE4Editor-ApplicationCore-Win64-Debug.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 2642	C++
 	UE4Editor-ApplicationCore-Win64-Debug.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 1048	C++
 	UE4Editor-ApplicationCore-Win64-Debug.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 877	C++
 	[External Code]	
 	UE4Editor-ApplicationCore-Win64-Debug.dll!WinPumpMessages() Line 109	C++
 	UE4Editor-ApplicationCore-Win64-Debug.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) Line 133	C++
 	UE4Editor-Win64-Debug.exe!FEngineLoop::Tick() Line 4748	C++
 	UE4Editor-Win64-Debug.exe!EngineTick() Line 63	C++
 	UE4Editor-Win64-Debug.exe!GuardedMain(const wchar_t * CmdLine) Line 172	C++
 	UE4Editor-Win64-Debug.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 257	C++

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-127950 in the post.

0
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint Compiler
Affects Versions4.264.275.0-early access
Target Fix5.0
Fix Commit17651667
Main Commit17651638
CreatedSep 27, 2021
ResolvedSep 28, 2021
UpdatedNov 30, 2021