Description

In some scenarios, FPropertyDelegate::SignatureFunction can point to freed memory after a garbage collection run. This appears to be more common when running the CompileAllBlueprints commandlet.

Steps to Reproduce

Note: testing requires a small modification of engine code:

  1. Extract the attach project
  2. In UCompileAllBlueprintsCommandlet::BuildBlueprints, comment out the line "if (TimeNow - LastGCTime >= 10.0)"
  3. Build the engine with the change
  4. Run the commandlet "BPDelegateCrash -run=CompileAllBlueprints -AllowListFile=CompileBPs.txt"
Callstack

> UnrealEditor-CoreUObject-Win64-Debug.dll!FDuplicateDataWriter::operator<<(UObject * & Object) Line 65 C+> UnrealEditor-CoreUObject-Win64-Debug.dll!FDuplicateDataWriter::operator<<(UObject * & Object) Line 65 C  UnrealEditor-CoreUObject-Win64-Debug.dll!FDelegateProperty::Serialize(FArchive & Ar) Line 168 C  UnrealEditor-CoreUObject-Win64-Debug.dll!UStruct::SerializeProperties(FArchive & Ar) Line 1783 C  UnrealEditor-CoreUObject-Win64-Debug.dll!UStruct::Serialize(FArchive & Ar) Line 1861 C  UnrealEditor-CoreUObject-Win64-Debug.dll!UFunction::Serialize(FArchive & Ar) Line 5925 C  UnrealEditor-CoreUObject-Win64-Debug.dll!StaticDuplicateObjectEx(FObjectDuplicationParameters & Parameters) Line 2174 C  UnrealEditor-CoreUObject-Win64-Debug.dll!StaticDuplicateObject(const UObject * SourceObject, UObject * DestOuter, const FName DestName, EObjectFlags FlagMask, UClass * DestClass, EDuplicateMode::Type DuplicateMode, EInternalObjectFlags InternalFlagsMask) Line 2061 C  UnrealEditor-UnrealEd-Win64-Debug.dll!FBlueprintCompileReinstancer::MoveDependentSkelToReinst(UClass * OwnerClass, TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0>> & OldToNewMap) Line 1663 C  UnrealEditor-Kismet-Win64-Debug.dll!FBlueprintCompilationManagerImpl::FlushCompilationQueueImpl(bool bSuppressBroadcastCompiled, TArray<UBlueprint *,TSizedDefaultAllocator<32>> * BlueprintsCompiled, TArray<UBlueprint *,TSizedDefaultAllocator<32>> * BlueprintsCompiledOrSkeletonCompiled, FUObjectSerializeContext * InLoadContext) Line 889 C  UnrealEditor-Kismet-Win64-Debug.dll!FBlueprintCompilationManagerImpl::CompileSynchronouslyImpl(const FBPCompileRequestInternal & Request) Line 267 C  UnrealEditor-Kismet-Win64-Debug.dll!FBlueprintCompilationManager::CompileSynchronously(const FBPCompileRequest & Request) Line 3159 C  UnrealEditor-UnrealEd-Win64-Debug.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, EBlueprintCompileOptions CompileFlags, FCompilerResultsLog * pResults) Line 761 C  UnrealEditor-UnrealEd-Win64-Debug.dll!UCompileAllBlueprintsCommandlet::CompileBlueprint(UBlueprint * Blueprint) Line 315 C  UnrealEditor-UnrealEd-Win64-Debug.dll!UCompileAllBlueprintsCommandlet::BuildBlueprints() Line 162 C  UnrealEditor-UnrealEd-Win64-Debug.dll!UCompileAllBlueprintsCommandlet::Main(const FString & Params) Line 40 C  UnrealEditor-Win64-Debug.exe!FEngineLoop::PreInitPostStartupScreen(const wchar_t * CmdLine) Line 3659 C  UnrealEditor-Win64-Debug.exe!FEngineLoop::PreInit(const wchar_t * CmdLine) Line 3883 C  UnrealEditor-Win64-Debug.exe!EnginePreInit(const wchar_t * CmdLine) Line 42 C  UnrealEditor-Win64-Debug.exe!GuardedMain(const wchar_t * CmdLine) Line 137 C  UnrealEditor-Win64-Debug.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * _formal, int nCmdShow, const wchar_t * CmdLine) Line 272 C  UnrealEditor-Win64-Debug.exe!WinMain(HINSTANCE_ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 330 C+

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint Compiler
Affects Versions5.0
Target Fix5.1
Fix Commit21489476
Main Commit21489476
CreatedAug 19, 2022
ResolvedAug 22, 2022
UpdatedSep 30, 2022