DynamicWind not unregistering proxies bug

Hi!

It seems that FSkinnedSceneProxy’s never get unregistered from the DynamicWind system (?)

In FDynamicWindTransformProvider::UnregisterSceneProxy, there’s an early out that says:

if (SkinningSceneExtProxy == nullptr || SkinningSceneExtProxy->GetTransformProviderId() != DynamicWindTransformProviderId)

This UnregisterSceneProxy is triggered by a OnDestroyRenderThreadResources delegate. It seems that, by the time it reaches the if above, it has already destroyed the RenderThreadResources, which makes FInstancedSkinningSceneExtensionProxy::TransformProviderProxy null. Due to this, when SkinningSceneExtProxy->GetTransformProviderId() is called, it does not identify itself as being of DynamicWind kind, but instead if falls back to REF_POSE_TRANSFORM_PROVIDER_GUID, and due to this the UnregisterSceneProxy earlies out, disregarding any proxy that arrives here. To check, I added a breakpoint after this early out, and it’s never triggered it (removing ISkMs with wind, reloading the level, etc.). I have added a fix that returns the TransformProviderId member directly for this specific check, without going through the TransformProviderProxy.

I don’t know if maybe I am wrong and it’s not really a bug, or if there’s a better way to fix it, or if this is already tracked and planned to be fixed in the future.

Thanks so much in advance! :smiley:

[Attachment Removed]

Steps to Reproduce

  • Create an ISkM with a DynamicWindSkeletalData assigned and a TransformProvider and a single instance, so that wind blows on it.
  • Add a breakpoint in the FDynamicWindTransformProvider::UnregisterSceneProxy, after all early outs.
  • Remove the ISkM, or simply reload the level. Notice how nothing never unregisters from it (at least in my case).
    [Attachment Removed]

Hi Victor,

Thanks for reporting this leak, we’ll probably implement a similar fix. I’ve created the following issue for tracking which should be visible publicly soon https://issues.unrealengine.com/issue/UE\-370935

[Attachment Removed]

Thank you very much Alex! :blush:

[Attachment Removed]

A fix has been submitted in CL#52064875 Fixed crash due to dynamic wind failing to unregister a proxy.

[Attachment Removed]