Showing the changes to Source/Libraries/GSF.ServiceProcess/ClientHelper.cs (1 of 1 file). Show all
Unified · Split
| @@ -644,7 +644,16 @@ namespace GSF.ServiceProcess · 643 unmodified lines | ||
| 644 | 644 | // This will be done only when the object is disposed by calling Dispose(). |
| 645 | 645 | Disconnect(); |
| 646 | 646 | SaveSettings(); |
| 647 | − RemotingClient = null; | |
| 647 | + | |
| 648 | + if ((object)m_remotingClient != null) | |
| 649 | + { | |
| 650 | + // Detach events from any existing instance | |
| 651 | + m_remotingClient.ConnectionEstablished -= RemotingClient_ConnectionEstablished; | |
| 652 | + m_remotingClient.ConnectionAttempt -= RemotingClient_ConnectionAttempt; | |
| 653 | + m_remotingClient.ConnectionException -= RemotingClient_ConnectionException; | |
| 654 | + m_remotingClient.ConnectionTerminated -= RemotingClient_ConnectionTerminated; | |
| 655 | + m_remotingClient.ReceiveDataComplete -= RemotingClient_ReceiveDataComplete; | |
| 656 | + } | |
| 648 | 657 | } |
| 649 | 658 | } |
| 650 | 659 | finally |