Fixed IDisposable implementation and usage.
- Implement IDisposable interface correctly, with sealed classes where possible for simplicity. - Add using statement around undisposed local variables.
This commit is contained in:
@@ -105,7 +105,7 @@ namespace OpenRA.Support
|
||||
}
|
||||
}
|
||||
|
||||
public class PerfSample : IDisposable
|
||||
public sealed class PerfSample : IDisposable
|
||||
{
|
||||
readonly Stopwatch sw = Stopwatch.StartNew();
|
||||
readonly string Item;
|
||||
|
||||
@@ -16,7 +16,7 @@ using System.Threading;
|
||||
|
||||
namespace OpenRA.Support
|
||||
{
|
||||
public class PerfTimer : IDisposable
|
||||
public sealed class PerfTimer : IDisposable
|
||||
{
|
||||
readonly string name;
|
||||
readonly float thresholdMs;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA
|
||||
|
||||
if (Game.Settings.Debug.ShowFatalErrorDialog && !Game.Settings.Server.Dedicated)
|
||||
{
|
||||
Game.Renderer.Device.Quit();
|
||||
Game.Renderer.Device.Dispose();
|
||||
Platform.ShowFatalErrorDialog();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user