aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-10-13 16:14:53 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-10-13 16:14:53 -0400
commitab3c26c5647a56e95d0f5229f07b1a1b45812ff8 (patch)
treebbcaf5db256364f19cdb4f7c18eb82171dc4183b /MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
parent8a15ee6ab4149cf59f8ff2724e3e415d34557da1 (diff)
update connect
Diffstat (limited to 'MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs')
-rw-r--r--MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs21
1 files changed, 16 insertions, 5 deletions
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
/// <param name="watcher">The watcher.</param>
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);
+ }
}
/// <summary>