mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Merge pull request #2375 from BlueBlock/fix_exception_for_protocolbase_when_closing_app
Update ProtocolBase.cs
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.UI.Tabs;
|
||||
using System.Runtime.Versioning;
|
||||
using mRemoteNG.UI.Forms;
|
||||
|
||||
// ReSharper disable UnusedMember.Local
|
||||
|
||||
@@ -88,8 +89,7 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't focus Control (Connection.Protocol.Base)",
|
||||
ex);
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't focus Control (Connection.Protocol.Base)", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +233,12 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
private void DisposeControl()
|
||||
{
|
||||
// do not attempt to dispose the control if the control is already closed, closing or disposed
|
||||
if (Control == null || !Control.IsAccessible || Control.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Control.InvokeRequired)
|
||||
{
|
||||
var s = new DisposeControlCB(DisposeControl);
|
||||
|
||||
Reference in New Issue
Block a user