UE 5.8 crash when CreateShapes_AssumesLocked return false during async creation

The crash occurs when the following conditions are met:

1) FBodyInstance is initialized via async code path (i.e. on worker thread instead of game thread).

2) CreateShapes_AssumesLocked returns false, indicating failure.

Under these conditions in UE 5.8, the following occurs:

1) CreateShapes_AssumesLocked return false, indicating failure.

2) As a result of the failure, Instance->BodySetup is set to null.

3) Execution proceeds to FBodyInstance::InitDynamicProperties_AssumesLocked.

4) Despite Instance->BodySetup being null, GetBodySetup called at the top of InitDynamicProperties_AssumesLocked returns non-null due to UE 5.8 addition of FBodyInstancePhysicsCreationInputs::ResolvedBodySetup.

5) InitDynamicProperties_AssumesLocked proceeds, leading to null pointer deference.

Conversely in UE 5.7, the following occurs:

4) Because Instance->BodySetup is null, GetBodySetup called at the top of InitDynamicProperties_AssumesLocked returns null.

4) InitDynamicProperties_AssumesLocked returns early, avoiding null pointer dereference.

In terms of a workaround:

1) Instance->BodySetup == null is no longer a reliable indication that physics creation failed. Instance->ActorHandle == null seems the next best indication.

2) To recreate the behavior of step 4 in UE 5.7, it seems safest to make InitDynamicProperties_AssumesLocked early out if Instance->ActorHandle == null.

[Attachment Removed]

Steps to Reproduce

Manufacturer a use-case (e.g. a BodySetup with zero collision primitives) that causes CreateShapes_AssumesLocked to return false during async physics creation.

[Attachment Removed]

Hi Graham,

Thank you for the ticket, and we’ve had reports of this from elsewhere as a regression in 5.8., and confirmed on our end. I’ll get a Bugfix Jira created today and send you the ticket.

Best

Geoff Stacey

Developer Relations

EPIC Games

[Attachment Removed]

Hi Graham, the bug is posted on https://issues.unrealengine.com/issue/UE-389735, and you will be able to follow its progress there. I’d expect this to be fixed within the next few weeks given what it is.

Best

Geoff

[Attachment Removed]