From b366db71751eede77df88b949ac941aa2c305cb9 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 11 Oct 2021 14:17:01 +0200 Subject: [PATCH] Revert "Directly run unsynced functions if we don't check sync hashes" This reverts commit 1dc0a603c75132776f669789e89596b15245ea26. --- OpenRA.Game/Sync.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Sync.cs b/OpenRA.Game/Sync.cs index 7fc3954d97..982a57d7be 100644 --- a/OpenRA.Game/Sync.cs +++ b/OpenRA.Game/Sync.cs @@ -181,10 +181,10 @@ namespace OpenRA public static T RunUnsynced(bool checkSyncHash, World world, Func fn) { // PERF: Detect sync changes in top level entry point only. Do not recalculate sync hash during reentry. - if (!checkSyncHash || inUnsyncedCode || world == null) + if (inUnsyncedCode || world == null) return fn(); - var sync = world.SyncHash(); + var sync = checkSyncHash ? world.SyncHash() : 0; inUnsyncedCode = true; try @@ -197,7 +197,7 @@ namespace OpenRA // When the world is disposing all actors and effects have been removed // So do not check the hash for a disposing world since it definitively has changed - if (!world.Disposing && sync != world.SyncHash()) + if (checkSyncHash && !world.Disposing && sync != world.SyncHash()) throw new InvalidOperationException("RunUnsynced: sync-changing code may not run here"); } }