Description

TriggerMontageEndedEvent is calling RemoveAtSwap after the NotifyEnd callback which is not safe if the ActiveAninNotifyState array is modified by the callback.

 

WorkAround:   Add a Delay node before calling DestroyActor.  Licensee suggests "It might be safer to cache the array before iterating or somehow lock the array or block certain functions."

 

 

Steps to Reproduce

*Project has been attached for easier replication

  1. Create a new Blueprint Third Person Template Project
  1. Open the ThirdPersonCharacter Blueprint
  1. Add a new Custom Event "KillActor" and have it call DestroyActor on self
  1. Create a new AnimNotifyState Blueprint (Notify_Death)
  1. Open the AnimNotifyState Blueprint.
  1. Within the AnimNotifyState Blueprint Override Received Notify End function of the state Blueprint.
  1. Create a new Montage from any sequence (ex. jump)
  1. Add Notify State (Notify_Death) to the Notifies track of your new montage
  1. Implement function on Notify End with GetOwner/Cast-to-ThirdPersonCharacter and call KillActor function.
  1. Open the ThirdPersonCharacter Blueprint again
  1. Implement a keyboard "X" trigger and PlayAnimMontage for the new animation
  1. PIE and press the X key...

Result: Editor crash.

Expected: Montage to play successfully, calling destroy actor at the notify end function.

Callstack
LoginId:677a448d48352201d90930b796056d79
EpicAccountId:74cb1785c0a148f0a87ef74601ae977a

Unhandled exception

VCRUNTIME140
UE4Editor_Engine!UAnimInstance::TriggerMontageEndedEvent() [d:\ue4 monteue4main\engine\source\runtime\engine\private\animation\animinstance.cpp:1576]
UE4Editor_Engine!UAnimInstance::TriggerQueuedMontageEvents() [d:\ue4 monteue4main\engine\source\runtime\engine\private\animation\animinstance.cpp:1602]
UE4Editor_Engine!UAnimInstance::DispatchQueuedAnimEvents() [d:\ue4 monteue4main\engine\source\runtime\engine\private\animation\animinstance.cpp:553]
UE4Editor_Engine!USkeletalMeshComponent::ConditionallyDispatchQueuedAnimEvents() [d:\ue4 monteue4main\engine\source\runtime\engine\private\components\skeletalmeshcomponent.cpp:1306]
UE4Editor_Engine!USkeletalMeshComponent::FinalizeBoneTransform() [d:\ue4 monteue4main\engine\source\runtime\engine\private\components\skeletalmeshcomponent.cpp:3631]
UE4Editor_Engine!USkeletalMeshComponent::FinalizeAnimationUpdate() [d:\ue4 monteue4main\engine\source\runtime\engine\private\physicsengine\physanim.cpp:394]
UE4Editor_Engine!USkeletalMeshComponent::PostAnimEvaluation() [d:\ue4 monteue4main\engine\source\runtime\engine\private\components\skeletalmeshcomponent.cpp:2433]
UE4Editor_Engine!USkeletalMeshComponent::CompleteParallelAnimationEvaluation() [d:\ue4 monteue4main\engine\source\runtime\engine\private\components\skeletalmeshcomponent.cpp:3522]
UE4Editor_Engine!FParallelAnimationCompletionTask::DoTask() [d:\ue4 monteue4main\engine\source\runtime\engine\private\components\skeletalmeshcomponent.cpp:151]
UE4Editor_Engine!TGraphTask<FParallelAnimationCompletionTask>::ExecuteTask() [d:\ue4 monteue4main\engine\source\runtime\core\public\async\taskgraphinterfaces.h:847]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\ue4 monteue4main\engine\source\runtime\core\private\async\taskgraph.cpp:685]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\ue4 monteue4main\engine\source\runtime\core\private\async\taskgraph.cpp:582]
UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [d:\ue4 monteue4main\engine\source\runtime\core\private\async\taskgraph.cpp:1457]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [d:\ue4 monteue4main\engine\source\runtime\engine\private\ticktaskmanager.cpp:557]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [d:\ue4 monteue4main\engine\source\runtime\engine\private\ticktaskmanager.cpp:1518]
UE4Editor_Engine!UWorld::RunTickGroup() [d:\ue4 monteue4main\engine\source\runtime\engine\private\leveltick.cpp:789]
UE4Editor_Engine!UWorld::Tick() [d:\ue4 monteue4main\engine\source\runtime\engine\private\leveltick.cpp:1595]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\ue4 monteue4main\engine\source\editor\unrealed\private\editorengine.cpp:1618]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\ue4 monteue4main\engine\source\editor\unrealed\private\unrealedengine.cpp:403]
UE4Editor_Win64_DebugGame!FEngineLoop::Tick() [d:\ue4 monteue4main\engine\source\runtime\launch\private\launchengineloop.cpp:4207]
UE4Editor_Win64_DebugGame!GuardedMain() [d:\ue4 monteue4main\engine\source\runtime\launch\private\launch.cpp:173]
UE4Editor_Win64_DebugGame!GuardedMainWrapper() [d:\ue4 monteue4main\engine\source\runtime\launch\private\windows\launchwindows.cpp:147]
UE4Editor_Win64_DebugGame!WinMain() [d:\ue4 monteue4main\engine\source\runtime\launch\private\windows\launchwindows.cpp:277]
UE4Editor_Win64_DebugGame!__scrt_common_main_seh() [d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Have Comments or More Details?

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

2
Login to Vote

Fixed
ComponentOLD - Anim
Affects Versions4.204.214.224.23
Target Fix4.23
Fix Commit6840981
Main Commit6863572
CreatedMay 6, 2019
ResolvedJun 4, 2019
UpdatedMay 18, 2020
View Jira Issue