From b0becb50d13d2b01f24be7c3b4ee4618b70e6aac Mon Sep 17 00:00:00 2001 From: Deathmax Date: Mon, 19 Dec 2011 22:29:59 +0800 Subject: [PATCH] Dispose of log's streamwriter properly. Fixes issues if TShock is reloaded. --- TShockAPI/Log.cs | 8 ++++++++ TShockAPI/TShock.cs | 1 + 2 files changed, 9 insertions(+) diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs index 6e158927..3096e765 100644 --- a/TShockAPI/Log.cs +++ b/TShockAPI/Log.cs @@ -131,6 +131,14 @@ namespace TShockAPI Write(message, LogLevel.Debug); } + /// + /// Disposes objects that are being used. + /// + public static void Dispose() + { + _logWriter.Dispose(); + } + /// /// Internal method which writes a message directly to the log file. /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 617d2e56..895a70ca 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -309,6 +309,7 @@ namespace TShockAPI File.Delete(Path.Combine(SavePath, "tshock.pid")); } RestApi.Dispose(); + Log.Dispose(); } base.Dispose(disposing);