Fix RegistryKey dispose
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
@@ -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); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user