diff --git a/EDPlayerJournal/JournalStream.cs b/EDPlayerJournal/JournalStream.cs index 5eb61c1..f2fd678 100644 --- a/EDPlayerJournal/JournalStream.cs +++ b/EDPlayerJournal/JournalStream.cs @@ -121,6 +121,12 @@ internal class FileWatcherThread : IDisposable { } public void Close() { + if (thread != null) { + done = true; + Signal(); + thread.Join(); + thread = null; + } if (stream != null) { stream.Close(); stream = null; @@ -129,12 +135,6 @@ internal class FileWatcherThread : IDisposable { file.Close(); file = null; } - if (thread != null) { - done = true; - Signal(); - thread.Join(); - thread = null; - } } void IDisposable.Dispose() { @@ -249,6 +249,9 @@ public class JournalStream { watcher.EnableRaisingEvents = false; } watcher = null; + foreach (var stream in streams) { + stream.Value.Close(); + } streams.Clear(); }