Fix TOCTOU issues when calling Game.RunAfterDelay.
Since the action runs after a delay, the state of the game may no longer be the same and it may no longer be valid to run the action. Anything that references the world now calls IsCurrentWorld to ensure the world hasn't changed or been disposed.
This commit is contained in:
@@ -767,7 +767,7 @@ namespace OpenRA
|
||||
|
||||
public static bool IsCurrentWorld(World world)
|
||||
{
|
||||
return OrderManager != null && OrderManager.World == world;
|
||||
return OrderManager != null && OrderManager.World == world && !world.Disposing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user