Description

https://udn.unrealengine.com/questions/236428/bug-blueprints-executing-zombie-code.html

Blueprint MyCharacter is based on native class CodeFirstPersonCharacter.
CodeFirstPersonCharacter has component PawnSensing, that is not overriden/modified in MyCharacter.
In CodeFirstPersonCharacter's constructor a multicast delegate from PawnSensing is filled:

PawnSensing->OnSeePawn.AddDynamic(this, &ACodeFirstPersonCharacter::OnSeePawn);

PawnSensing component in MyCharacter's CDO (lets call it P1) should be exactly the same as in CodeFirstPersonCharacter's CDO (P2).
The delegate in P1 references MyCharacter's CDO and the delegate in P2 references CodeFirstPersonCharacter's CDO.
Although P1 and P2 are conceptually identical, they are not handled as identical while delta-serialization.
Let me know if the description is clear.

1. Do we want to fix the issue at all?
2. Can it be fixed?

Steps to Reproduce

4.20 Bug Scrub

  1. Create a Code First Person Template project, name it CodeFirstPerson
  2. Add to CodeFirstPersonCharacter.h:
    public:
         ACodeFirstPersonCharacter(const FObjectInitializer& ObjectInitializer);
         UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = AI)
          class UPawnSensingComponent* PawnSensing;
     
          UFUNCTION()
          void OnSeePawn(APawn* Pawn);
    
  3. Add to CodeFirstPersonCharacter.cpp:
     #include "Perception/PawnSensingComponent.h"
    ACodeFirstPersonCharacter::ACodeFirstPersonCharacter(const FObjectInitializer& ObjectInitializer) : ACodeFirstPersonCharacter()
    {	
    	PawnSensing = ObjectInitializer.CreateDefaultSubobject<UPawnSensingComponent>(this, TEXT("PawnSensing"));	
            PawnSensing->OnSeePawn.AddDynamic(this, &ACodeFirstPersonCharacter::OnSeePawn);
    }
    
    void ACodeFirstPersonCharacter::OnSeePawn(APawn* Pawn)
    {
    }
    
  4. Add AIModule to CodeFirstPerson.Build.cs
    PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","AIModule" });
    
  5. Build the project for Development Editor
  6. Open the project in the editor
  7. PIE
  8. Open the First Person Character Blueprint Class and change away from default values:
    • Sight Radius
    • Gun Offset
  9. Compile & Save the blueprint
  10. Close the Editor
  11. In CodeFirstPersonCharacter.cpp move the line
     PawnSensing->OnSeePawn.AddDynamic(this,  ACodeFirstPersonCharacter::OnSeePawn); 

    from the end our new constructor to the end of ACodeFirstPersonCharacter::BeginPlay()

  12. Compile for Development Editor
  13. Open the project in the editor
  14. PIE

Result:
Ensure is thrown at the start of the first PIE

 Ensure condition failed: InvocationList[ CurFunctionIndex ] != InDelegate 

Expected:
No ensure is thrown

Callstack
LogOutputDevice: Error: Ensure condition failed: InvocationList[ CurFunctionIndex ] != InDelegate [File:D:\P4_Workspaces\Main\Engine\Source\Runtime\Core\Public\UObject/ScriptDelegates.h] [Line: 509]
LogOutputDevice: Error: Stack: 
LogOutputDevice: Error: [Callstack] 0x00000000410C8616 UE4Editor-Core.dll!FWindowsPlatformStackWalk::StackWalkAndDump() [d:\p4_workspaces\main\engine\source\runtime\core\private\windows\windowsplatformstackwalk.cpp:234]
LogOutputDevice: Error: [Callstack] 0x0000000040E18922 UE4Editor-Core.dll!FDebug::EnsureFailed() [d:\p4_workspaces\main\engine\source\runtime\core\private\misc\assertionmacros.cpp:299]
LogOutputDevice: Error: [Callstack] 0x0000000040E31EC6 UE4Editor-Core.dll!FDebug::OptionallyLogFormattedEnsureMessageReturningFalse() [d:\p4_workspaces\main\engine\source\runtime\core\private\misc\assertionmacros.cpp:433]
LogOutputDevice: Error: [Callstack] 0x0000000013873C83 UE4Editor-CodeFirstPerson.dll!TMulticastScriptDelegate<FWeakObjectPtr>::AddInternal() [d:\p4_workspaces\main\engine\source\runtime\core\public\uobject\scriptdelegates.h:509]
LogOutputDevice: Error: [Callstack] 0x0000000013874059 UE4Editor-CodeFirstPerson.dll!ACodeFirstPersonCharacter::BeginPlay() [d:\documents\unreal projects\codefirstperson\source\codefirstperson\codefirstpersoncharacter.cpp:118]
LogOutputDevice: Error: [Callstack] 0x0000000024CB47CA UE4Editor-Engine.dll!AActor::DispatchBeginPlay() [d:\p4_workspaces\main\engine\source\runtime\engine\private\actor.cpp:3145]
LogOutputDevice: Error: [Callstack] 0x0000000025FFFE2E UE4Editor-Engine.dll!AWorldSettings::NotifyBeginPlay() [d:\p4_workspaces\main\engine\source\runtime\engine\private\worldsettings.cpp:191]
LogOutputDevice: Error: [Callstack] 0x0000000025461EA1 UE4Editor-Engine.dll!AGameStateBase::HandleBeginPlay() [d:\p4_workspaces\main\engine\source\runtime\engine\private\gamestatebase.cpp:177]
LogOutputDevice: Error: [Callstack] 0x0000000025FE6D9E UE4Editor-Engine.dll!UWorld::BeginPlay() [d:\p4_workspaces\main\engine\source\runtime\engine\private\world.cpp:3650]
LogOutputDevice: Error: [Callstack] 0x0000000025489B77 UE4Editor-Engine.dll!UGameInstance::StartPlayInEditorGameInstance() [d:\p4_workspaces\main\engine\source\runtime\engine\private\gameinstance.cpp:355]
LogOutputDevice: Error: [Callstack] 0x0000000023D4CC89 UE4Editor-UnrealEd.dll!UEditorEngine::CreatePIEGameInstance() [d:\p4_workspaces\main\engine\source\editor\unrealed\private\playlevel.cpp:3271]
LogOutputDevice: Error: [Callstack] 0x0000000023D6FDBB UE4Editor-UnrealEd.dll!UEditorEngine::PlayInEditor() [d:\p4_workspaces\main\engine\source\editor\unrealed\private\playlevel.cpp:2410]
LogOutputDevice: Error: [Callstack] 0x0000000023D8C3D4 UE4Editor-UnrealEd.dll!UEditorEngine::StartQueuedPlayMapRequest() [d:\p4_workspaces\main\engine\source\editor\unrealed\private\playlevel.cpp:1271]
LogOutputDevice: Error: [Callstack] 0x00000000237D3031 UE4Editor-UnrealEd.dll!UEditorEngine::Tick() [d:\p4_workspaces\main\engine\source\editor\unrealed\private\editorengine.cpp:1580]
LogOutputDevice: Error: [Callstack] 0x00000000240C08F6 UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick() [d:\p4_workspaces\main\engine\source\editor\unrealed\private\unrealedengine.cpp:401]
LogOutputDevice: Error: [Callstack] 0x0000000067B860B8 UE4Editor.exe!FEngineLoop::Tick() [d:\p4_workspaces\main\engine\source\runtime\launch\private\launchengineloop.cpp:3382]
LogOutputDevice: Error: [Callstack] 0x0000000067B9629C UE4Editor.exe!GuardedMain() [d:\p4_workspaces\main\engine\source\runtime\launch\private\launch.cpp:166]
LogOutputDevice: Error: [Callstack] 0x0000000067B9631A UE4Editor.exe!GuardedMainWrapper() [d:\p4_workspaces\main\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
LogOutputDevice: Error: [Callstack] 0x0000000067BA424E UE4Editor.exe!WinMain() [d:\p4_workspaces\main\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
LogOutputDevice: Error: [Callstack] 0x0000000067BA5F0A UE4Editor.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283]
LogOutputDevice: Error: [Callstack] 0x0000000088928364 KERNEL32.DLL!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x0000000088B67091 ntdll.dll!UnknownFunction []
LogStats: SubmitErrorReport - 0.000 s
LogStats: SendNewReport - 0.456 s
LogStats: FDebug::EnsureFailed - 7.904 s

Have Comments or More Details?

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

4
Login to Vote

Backlogged
ComponentCore
Affects Versions4.84.20
CreatedFeb 18, 2015
UpdatedApr 11, 2018