diff --git a/MPF.Library/Data/DumpEnvironment.cs b/MPF.Library/Data/DumpEnvironment.cs index 866f200b..4ea4408c 100644 --- a/MPF.Library/Data/DumpEnvironment.cs +++ b/MPF.Library/Data/DumpEnvironment.cs @@ -396,7 +396,6 @@ namespace MPF.Data if (!Options.ToolsInSeparateWindow) { outputQueue.Dispose(); - outputQueue = null; Parameters.ReportStatus -= OutputToLog; } diff --git a/MPF.Library/Data/ProcessingQueue.cs b/MPF.Library/Data/ProcessingQueue.cs index e98442c3..9fcf92c5 100644 --- a/MPF.Library/Data/ProcessingQueue.cs +++ b/MPF.Library/Data/ProcessingQueue.cs @@ -44,6 +44,7 @@ namespace MPF.Data /// public void Enqueue(T item) { + // Only accept new data when not cancelled if (!this.TokenSource.IsCancellationRequested) this.InternalQueue.Enqueue(item); } @@ -55,13 +56,14 @@ namespace MPF.Data { while (true) { - // If cancellation was requested, just do it - if (this.TokenSource.IsCancellationRequested) - break; - // Nothing in the queue means we get to idle if (this.InternalQueue.Count == 0) + { + if (this.TokenSource.IsCancellationRequested) + break; + continue; + } // Get the next item from the queue if (!this.InternalQueue.TryDequeue(out T nextItem))