Remove event handlers to CellEntryChanged when done.
Several classes would attach event handlers to the Map which would live longer then they did. Detaching them when no longer needed allows the GC to reclaim them.
This commit is contained in:
@@ -442,5 +442,12 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
var v = (int)((p.Y - mapRect.Y) / previewScale) + world.Map.Bounds.Top;
|
||||
return new MPos(u, v).ToCPos(world.Map);
|
||||
}
|
||||
|
||||
public override void Removed()
|
||||
{
|
||||
base.Removed();
|
||||
world.Map.MapTiles.Value.CellEntryChanged -= UpdateTerrainCell;
|
||||
world.Map.CustomTerrain.CellEntryChanged -= UpdateTerrainCell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user