In EnhancedPlayerInput.cpp, UEnhancedPlayerInput::EvaluateInputComponentDelegates, the call to UE::Input::FPlayerInputDebugging::BroadcastPlayerInputDelegateExecuted will crash if the delegate execution before it disables/removes the same binding; this removes the FInputActionInstance from ActionInstanceData and causes ActionData->GetSourceAction() to return a dangling pointer.
Hello! We’re catching up on bug reports, so my apologies for the slow response.
I’m able to reproduce the bug based on your info. It hasn’t been addressed yet in the latest engine source either. I’ll go ahead and discuss with the enhanced input system owner to decide what we’ll do about this.
I’d like to double check something with you. For me, the easiest way to repro is by adding or removing mapping contexts with
which causes the mapping contexts to be updated synchronously instead of at end-of-frame. That’s what causes the FInputActionInstance* ActionData to be reallocated. Are you also using that option in your repro case? Just making sure we’ll cover all repro cases.
#if UE_PLAYER_INPUT_INCLUDE_DEBUG
// ActionData may not be valid if Delegate->Execute messes with the input mappings
ActionData = const_cast<FInputActionInstance*>(FindActionInstanceData(DelegateAction));
if (ActionData)
{
UE::Input::FPlayerInputDebugging::BroadcastPlayerInputDelegateExecuted(
this,
under the assumption that the second FindActionInstanceData will return the correct result. That being said, thinking about it now, it might make the debug function return incorrect data. (We don’t use it so we wouldn’t have noticed.)
Hey again, a small update on our side. The issue I created based on your report is live at UE-398245.
Your workaround sounds good. The page for UE-398245 will reflect when we’ve addressed this crash in engine code, but it’s targeting UE6 so don’t expect it soon.
I’ll close this case. Thank you for reporting the crash!