mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 14:07:46 +08:00
fix CA2213 warnings
This commit is contained in:
@@ -335,7 +335,8 @@ namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
if (!disposing) return;
|
||||
|
||||
tmrReconnect?.Dispose();
|
||||
if(tmrReconnect != null)
|
||||
tmrReconnect.Dispose();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -61,8 +61,11 @@ namespace mRemoteNG.Security
|
||||
{
|
||||
if (!disposing) return;
|
||||
|
||||
_machineKey?.Dispose();
|
||||
_secureString?.Dispose();
|
||||
if(_machineKey != null)
|
||||
_machineKey.Dispose();
|
||||
|
||||
if(_secureString != null)
|
||||
_secureString.Dispose();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -168,7 +168,8 @@ namespace mRemoteNG.Tools
|
||||
{
|
||||
if (!disposing) return;
|
||||
|
||||
Process?.Dispose();
|
||||
if(Process != null)
|
||||
Process.Dispose();
|
||||
|
||||
Handle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
@@ -69,8 +69,11 @@ namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
components?.Dispose();
|
||||
_statusImageList?.Dispose();
|
||||
if(components != null)
|
||||
components.Dispose();
|
||||
|
||||
if(_statusImageList != null)
|
||||
_statusImageList.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
|
||||
@@ -63,7 +63,8 @@ namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
components?.Dispose();
|
||||
if(components != null)
|
||||
components.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
|
||||
10
mRemoteV1/UI/Forms/PasswordForm.Designer.cs
generated
10
mRemoteV1/UI/Forms/PasswordForm.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
using TextBox = mRemoteNG.UI.Forms.TextBox;
|
||||
using TextBox = mRemoteNG.UI.Forms.TextBox;
|
||||
|
||||
namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
@@ -12,9 +12,13 @@ namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing && components != null)
|
||||
if (disposing)
|
||||
{
|
||||
components.Dispose();
|
||||
if(components != null)
|
||||
components.Dispose();
|
||||
|
||||
if(_password != null)
|
||||
_password.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
13
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
13
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace mRemoteNG.UI.Forms
|
||||
namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
public partial class FrmMain : System.Windows.Forms.Form
|
||||
{
|
||||
@@ -9,10 +9,15 @@ namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing && components != null)
|
||||
if (disposing)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
if(components != null)
|
||||
components.Dispose();
|
||||
|
||||
if(_screenSystemMenu != null)
|
||||
_screenSystemMenu.Dispose();
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -60,7 +60,8 @@ namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
if (!disposing) return;
|
||||
|
||||
_systemMenu?.Dispose();
|
||||
if(_systemMenu != null)
|
||||
_systemMenu.Dispose();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -357,16 +357,21 @@ namespace mRemoteNG.UI.Tabs
|
||||
ResumeLayout();
|
||||
}
|
||||
|
||||
// This seems like a bogus warning - suppressing since Components is being disposed...
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "<Components>k__BackingField")]
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
Components.Dispose();
|
||||
if(Components != null)
|
||||
Components.Dispose();
|
||||
|
||||
if (m_boldFont != null)
|
||||
{
|
||||
m_boldFont.Dispose();
|
||||
m_boldFont = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
|
||||
Reference in New Issue
Block a user