From ab3c26c5647a56e95d0f5229f07b1a1b45812ff8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 13 Oct 2014 16:14:53 -0400 Subject: update connect --- .../IO/LibraryMonitor.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs') diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index 09e0e91f5..ce6224295 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -310,12 +310,23 @@ namespace MediaBrowser.Server.Implementations.IO /// The watcher. private void DisposeWatcher(FileSystemWatcher watcher) { - Logger.Info("Stopping directory watching for path {0}", watcher.Path); - - watcher.EnableRaisingEvents = false; - watcher.Dispose(); + try + { + using (watcher) + { + Logger.Info("Stopping directory watching for path {0}", watcher.Path); - RemoveWatcherFromList(watcher); + watcher.EnableRaisingEvents = false; + } + } + catch + { + + } + finally + { + RemoveWatcherFromList(watcher); + } } /// -- cgit v1.2.3