FObjectReferenceCache::ResolveObjectReferenceHandleInternal can return objects marked for garbage- is that expected?

Hi again Iris friends!

In debugging some export issues, I’ve noticed that FObjectReferenceCache::ResolveObjectReferenceHandleInternal makes a call to FindObjectFast that doesn’t seem to prevent RF_Garbage marked objects from being found. This can lead to replicated properties or RPC params being resolved to objects that do not pass the IsValid test. This seems a bit suspicious given that if an object is fully unloaded, FObjectReferenceCache::ResolveObjectReferenceHandleInternal can result in async loading it- thus I would expect to get a fresh, non-garbage version of an object that can be counted on to pass IsValid. Is this expected? Am I just thinking about things wrong? Or should the function be changed to only return objects that are valid?

Thanks very much!

Josh

Hi,

Thanks for reporting the issue. This issue is also present with FNetGUIDCache. It does seem a bit scary to return a valid pointer to an invalid object as it requires everybody to always check even raw pointers for validity in their RPCs for example. I’ve created an issue UE-309528 for this.

Cheers,

Peter

Thanks!