We were diagnosing a crash that we saw where FGameplayTargetDataFilter SelfActor was not zeroed out by GC as would be expected from a TObjectPtr UPROPERTY because the FGameplayTargetDataFilterHandle only stores a reference to the FGameplayTargetDataFilter by TSharedPtr, preventing SelfActor from being considered actively referenced when GC runs.
We could fix our crash by making sure target data filters are not held across frames (though I’m not seeing any docs/comments explicitly stating this is an unsafe practice), but it got me thinking about whether or not the SelfActor property should be a TWeakObjectPtr instead. It seems like the ideal behavior would be for the filter to gracefully handle the SelfActor getting cleaned up, rather than preventing it from getting GC’d. I don’t see any changes to this in UE5, so I wanted to run this by you all to see if you think changing it to a TWeakObjectPtr makes sense?
[Attachment Removed]