Merge pull request #10346 from RoosterDragon/misc-fixes

Dispose fixes + misc touchups
This commit is contained in:
Paul Chote
2016-01-01 13:53:05 +00:00
15 changed files with 72 additions and 20 deletions

View File

@@ -125,6 +125,7 @@ namespace OpenRA.Mods.Common.Commands
world.IssueOrder(new Order(command, world.LocalPlayer.PlayerActor, false));
}
[Serializable]
class DevException : Exception { }
}
}

View File

@@ -90,6 +90,12 @@ namespace OpenRA.Mods.Common.LoadScreens
Game.Settings.Save();
}
public virtual void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

View File

@@ -79,12 +79,12 @@ namespace OpenRA.Mods.Common.LoadScreens
r.EndFrame(new NullInputHandler());
}
public override void Dispose()
protected override void Dispose(bool disposing)
{
if (sheet != null)
if (disposing && sheet != null)
sheet.Dispose();
base.Dispose();
base.Dispose(disposing);
}
}
}

View File

@@ -19,7 +19,7 @@ using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets
{
public class RadarWidget : Widget
public sealed class RadarWidget : Widget, IDisposable
{
public string WorldInteractionController = null;
public int AnimationLength = 5;
@@ -447,6 +447,12 @@ namespace OpenRA.Mods.Common.Widgets
base.Removed();
world.Map.MapTiles.Value.CellEntryChanged -= UpdateTerrainCell;
world.Map.CustomTerrain.CellEntryChanged -= UpdateTerrainCell;
Dispose();
}
public void Dispose()
{
radarSheet.Dispose();
}
}
}