Probably fixed an issue with the ArchivableConsoleLogMemory on disposing

This commit is contained in:
Serraniel 2017-04-17 11:20:57 +02:00
parent 44b2be2579
commit adf724bd7b
3 changed files with 20 additions and 7 deletions

View file

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.22.0")]
[assembly: AssemblyFileVersion("1.0.22.0")]
[assembly: AssemblyVersion("1.0.23.0")]
[assembly: AssemblyFileVersion("1.0.23.0")]

View file

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.24.0")]
[assembly: AssemblyFileVersion("0.1.24.0")]
[assembly: AssemblyVersion("0.1.25.0")]
[assembly: AssemblyFileVersion("0.1.25.0")]

View file

@ -34,12 +34,25 @@ namespace SweetLib.Utils.Logger.Memory
Dispose(false);
}
private void ProcessQueue()
private void ProcessQueue(bool isDisposing = false)
{
if (LogQueue.IsEmpty)
return;
lock (this)
// if we are disposing no need to lock. This might cause issues!
if (!isDisposing)
{
lock (this)
{
if (LogQueue.IsEmpty)
return;
LogMessage message;
if (LogQueue.TryDequeue(out message))
File.AppendAllText(TempFile, message.ToString());
}
}
else
{
if (LogQueue.IsEmpty)
return;
@ -129,7 +142,7 @@ namespace SweetLib.Utils.Logger.Memory
{
QueueTimer.Dispose();
ProcessQueue();
ProcessQueue(true);
if (AutoArchiveOnDispose)
{