Recompiling an ABP that another ABP has a Property Access dependency on without recompiling/linking the other causes a crash

The crash comes from the pointers in FAnimSubsystem_PropertyAccess::Library::Indirections in the layer ABP from pointing to old/invalid functions and properties from the trash ABP_Manny, as they have not been relinked after it was recompiled when manually recompiling the character BP it depends on.

The crash was found on 5.5 but is still present in 5.6.

I was able to prevent it by adding the following code to `UAnimBlueprintGeneratedClass::Link`, it’s rather hacky as I don’t have a great understanding of the compilation process:

// Avoid infinite recursion in case of circular dependencies
static TArray<const UAnimBlueprintGeneratedClass*, TInlineAllocator<4>> LinkStack;
for (const auto& Dependent : Cast<UBlueprint>(ClassGeneratedBy)->CachedDependents)
{
	LinkStack.Push(this);
	if (UBlueprint* BP = Dependent.Get())
	{
		if (UAnimBlueprintGeneratedClass* ABPC = Cast<UAnimBlueprintGeneratedClass>(BP->GeneratedClass); IsValid(ABPC))
		{
			if (!LinkStack.Contains(ABPC))
			{
				BP->GeneratedClass->StaticLink();
			}
		}
	}
	LinkStack.Pop();
}

Steps to Reproduce
Open the repro project (in UE 5.5 or 5.6), which includes

  • A base animation blueprint ABP_Manny, modified to
    • depend on BP_ThirdPersonCharacter
    • have a function GetMovementComponent which returns the character movement component
    • add a simple animation layer
  • An animation layer blueprint ABP_Layer which calls this GetMovementComponent in a property access node
  • A BP_ThirdPersonCharacter_WithRefToLayer which uses this layer and is placed in the level.

Open BP_ThirdPersonCharacter in the blueprint editor and press the Compile button. This will also cause its dependencies (including ABP_Manny) to recompile

Then press play in editor to trigger the crash.

Thanks for the repro! We have had this issue reported internally on our crash reporter, but were unable to synthesize a local repro. This will be very helpful.

FWIW, some of this code was hardened in 5.7 (such as guarding against null functions/return properties), but I can imagine that it will still crash given the repro steps you give here.

I’ve opened a ticket to take a look at this (Unreal Engine Issues and Bug Tracker (UE\-346992\)).

I just checked the repro project against 5.7 and it looks like the crash no longer occurs. What is the expected behavior of that project? The player character is in t-pose following the repro steps.

For reference the P4 CL in 5.7 this was addressed was 45959023 (Github).

Thank you, good to know.

I’m afraid the sample project isn’t supposed to do anything except trigger the crash, I’m not familiar with animation so I just took recreated the basic circumstances necessary to reproduce it.

The crash fix looks like it would leave the invalid property access unevaluated causing incorrect behavior, but that would require a better sample to test.