Merge pull request #8268 from obrakmann/fix8262_d2k_double_remove_from_world

Fix potentially removing actors twice from world in Actor::ChangeOwner
This commit is contained in:
Matthias Mailänder
2015-05-27 22:03:43 +02:00

View File

@@ -242,11 +242,16 @@ namespace OpenRA
return;
var oldOwner = Owner;
var wasInWorld = IsInWorld;
// momentarily remove from world so the ownership queries don't get confused
if (wasInWorld)
w.Remove(this);
Owner = newOwner;
Generation++;
if (wasInWorld)
w.Add(this);
foreach (var t in this.TraitsImplementing<INotifyOwnerChanged>())