Revert "Directly run unsynced functions if we don't check sync hashes"

This reverts commit 1dc0a603c7.
This commit is contained in:
abcdefg30
2021-10-11 14:17:01 +02:00
committed by teinarss
parent 3ce32fe354
commit b366db7175

View File

@@ -181,10 +181,10 @@ namespace OpenRA
public static T RunUnsynced<T>(bool checkSyncHash, World world, Func<T> 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");
}
}