Fix #5414
This commit is contained in:
@@ -198,16 +198,21 @@ namespace OpenRA.Network
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool disposed;
|
bool disposed;
|
||||||
public void Dispose()
|
protected void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposed) return;
|
if (disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
Connection.Dispose();
|
if (disposing)
|
||||||
|
Connection.Dispose();
|
||||||
|
|
||||||
disposed = true;
|
disposed = true;
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~OrderManager() { Dispose(); }
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Widgets;
|
|||||||
|
|
||||||
namespace OpenRA.Network
|
namespace OpenRA.Network
|
||||||
{
|
{
|
||||||
class ReplayRecorderConnection : IConnection
|
class ReplayRecorderConnection : IConnection, IDisposable
|
||||||
{
|
{
|
||||||
public ReplayMetadata Metadata;
|
public ReplayMetadata Metadata;
|
||||||
|
|
||||||
@@ -98,27 +98,30 @@ namespace OpenRA.Network
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool disposed;
|
bool disposed;
|
||||||
|
protected void Dispose(bool disposing)
|
||||||
public void Dispose()
|
|
||||||
{
|
{
|
||||||
if (disposed)
|
if (disposed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Metadata != null)
|
if (disposing)
|
||||||
{
|
{
|
||||||
if (Metadata.GameInfo != null)
|
if (Metadata != null)
|
||||||
Metadata.GameInfo.EndTimeUtc = DateTime.UtcNow;
|
{
|
||||||
Metadata.Write(writer);
|
if (Metadata.GameInfo != null)
|
||||||
|
Metadata.GameInfo.EndTimeUtc = DateTime.UtcNow;
|
||||||
|
Metadata.Write(writer);
|
||||||
|
}
|
||||||
|
writer.Close();
|
||||||
|
inner.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.Close();
|
|
||||||
inner.Dispose();
|
|
||||||
disposed = true;
|
disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
~ReplayRecorderConnection()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose();
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user