Dispose MapPreviews and map packages.

This commit is contained in:
Paul Chote
2016-02-26 08:46:07 +00:00
parent b5f792b997
commit bee3eb2c0a
2 changed files with 13 additions and 1 deletions

View File

@@ -269,6 +269,9 @@ namespace OpenRA
return;
}
foreach (var p in previews.Values)
p.Dispose();
// We need to let the loader thread exit before we can dispose our sheet builder.
// Ideally we should dispose our resources before returning, but we don't to block waiting on the loader thread to exit.
// Instead, we'll queue disposal to be run once it has exited.

View File

@@ -53,7 +53,7 @@ namespace OpenRA
public readonly bool downloading;
}
public class MapPreview
public class MapPreview : IDisposable
{
static readonly CPos[] NoSpawns = new CPos[] { };
MapCache cache;
@@ -344,5 +344,14 @@ namespace OpenRA
{
Status = MapStatus.Unavailable;
}
public void Dispose()
{
if (Package != null)
{
Package.Dispose();
Package = null;
}
}
}
}