Fix ImpersonationHandle so that it survives multiple disposes.

This commit is contained in:
antiduh
2014-06-27 01:43:08 +00:00
parent 85288a9dae
commit fc9daf3611

View File

@@ -24,6 +24,7 @@ namespace NSspi.Contexts
internal ImpersonationHandle(ServerContext server)
{
this.server = server;
this.disposed = false;
}
~ImpersonationHandle()
@@ -39,7 +40,7 @@ namespace NSspi.Contexts
protected virtual void Dispose( bool disposing )
{
if( disposing && this.server != null && this.server.Disposed == false )
if( disposing && this.disposed == false && this.server != null && this.server.Disposed == false )
{
this.server.RevertImpersonate();
}