瀏覽代碼

add disposed check to FileRefresher

Luke Pulverenti 8 年之前
父節點
當前提交
1686443ba6
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      MediaBrowser.Server.Implementations/IO/FileRefresher.cs

+ 6 - 0
MediaBrowser.Server.Implementations/IO/FileRefresher.cs

@@ -68,6 +68,11 @@ namespace MediaBrowser.Server.Implementations.IO
 
             lock (_timerLock)
             {
+                if (_disposed)
+                {
+                    return;
+                }
+
                 if (_timer == null)
                 {
                     _timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
@@ -287,6 +292,7 @@ namespace MediaBrowser.Server.Implementations.IO
                 if (_timer != null)
                 {
                     _timer.Dispose();
+                    _timer = null;
                 }
             }
         }