浏览代码

Apply patch 14803

olegkap_cp 12 年之前
父节点
当前提交
c7d162111b
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      Renci.SshClient/Renci.SshNet/Channels/Channel.cs

+ 8 - 4
Renci.SshClient/Renci.SshNet/Channels/Channel.cs

@@ -531,22 +531,26 @@ namespace Renci.SshNet.Channels
         {
             this.OnDisconnected();
 
-            //  If objected is disposed or being disposed don't handle this event
+            //  If object is disposed or being disposed don't handle this event
             if (this._isDisposed)
                 return;
 
-            this._disconnectedWaitHandle.Set();
+            EventWaitHandle disconnectedWaitHandle = this._disconnectedWaitHandle;
+            if (disconnectedWaitHandle != null)
+                disconnectedWaitHandle.Set();
         }
 
         private void Session_ErrorOccured(object sender, ExceptionEventArgs e)
         {
             this.OnErrorOccured(e.Exception);
 
-            //  If objected is disposed or being disposed don't handle this event
+            //  If object is disposed or being disposed don't handle this event
             if (this._isDisposed)
                 return;
 
-            this._errorOccuredWaitHandle.Set();
+            EventWaitHandle errorOccuredWaitHandle = this._errorOccuredWaitHandle;
+            if (errorOccuredWaitHandle != null)
+                errorOccuredWaitHandle.Set();
         }
 
         #region Channel message event handlers