Browse Source

Fix RegistryKey dispose

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
tags/3.3.2
Syrone Wong 8 years ago
parent
commit
13ebb5ef01
2 changed files with 20 additions and 10 deletions
  1. +8
    -4
      shadowsocks-csharp/Controller/System/AutoStartup.cs
  2. +12
    -6
      shadowsocks-csharp/Controller/System/SystemProxy.cs

+ 8
- 4
shadowsocks-csharp/Controller/System/AutoStartup.cs View File

@@ -39,8 +39,10 @@ namespace Shadowsocks.Controller
{
if (runKey != null)
{
try { runKey.Close(); }
catch (Exception e)
try {
runKey.Close();
runKey.Dispose();
} catch (Exception e)
{ Logging.LogUsefulException(e); }
}
}
@@ -84,8 +86,10 @@ namespace Shadowsocks.Controller
{
if (runKey != null)
{
try { runKey.Close(); }
catch (Exception e)
try {
runKey.Close();
runKey.Dispose();
} catch (Exception e)
{ Logging.LogUsefulException(e); }
}
}


+ 12
- 6
shadowsocks-csharp/Controller/System/SystemProxy.cs View File

@@ -84,8 +84,10 @@ namespace Shadowsocks.Controller
MessageBox.Show( I18N.GetString( "Failed to update registry" ) );
} finally {
if ( registry != null ) {
try { registry.Close(); }
catch (Exception e)
try {
registry.Close();
registry.Dispose();
} catch (Exception e)
{ Logging.LogUsefulException(e); }
}
}
@@ -119,8 +121,10 @@ namespace Shadowsocks.Controller
Logging.LogUsefulException( e );
} finally {
if ( registry != null ) {
try { registry.Close(); }
catch (Exception e)
try {
registry.Close();
registry.Dispose();
} catch (Exception e)
{ Logging.LogUsefulException(e); }
}
}
@@ -165,8 +169,10 @@ namespace Shadowsocks.Controller
} finally {
if (registry != null)
{
try { registry.Close(); }
catch (Exception e)
try {
registry.Close();
registry.Dispose();
} catch (Exception e)
{ Logging.LogUsefulException(e); }
}
}


Loading…
Cancel
Save