Hi Iris friends!
I notice in 5.6 you’ve added delayed replication-stopping to UReplicationBridge::StopReplicatingNetRefHandle so that InternalDetachInstanceFromNetRefHandle doesn’t happen while reading.
I’m hitting an ensure, though, when my client decides that in a certain actor’s `TornOff()` method, it needs to destroy itself instead of just being torn off. The destroy call ends up trying to stop replicating a second time in the same frame, and we hit this ensure:
{
EEndReplicationFlags* PreviousFlags = HandlesToStopReplicating.Find(Handle);
const bool bPreviousFlagsMatch = PreviousFlags ? (*PreviousFlags) == EndReplicationFlags : true;
ensureMsgf(bPreviousFlagsMatch, TEXT("Received multiple StopReplicating calls for %s with different EndReplicationFlags: Previous: %s | Newest: %s"),
*NetRefHandleManager->PrintObjectFromNetRefHandle(Handle), *LexToString(*PreviousFlags), *LexToString(EndReplicationFlags));
}
the problem is that the first time the flags were just for the tear off being replicated, and the second time the flags are set to destroy the object (this is because destroying the object triggers EndPlay which calls EndsReplication, which ends up calling UReplicationBridge::StopReplicatingNetRefHandle with Destroy flags as a param)
What’s the fix here? Is there an engine fix that should be made, or is it just illegal to call Destroy on the client on an actor in response to it being TornOff?
Thanks!
Josh
[Attachment Removed]