From fc9daf36112bc68a3437ed34f941f3ca0f735db1 Mon Sep 17 00:00:00 2001 From: antiduh Date: Fri, 27 Jun 2014 01:43:08 +0000 Subject: [PATCH] Fix ImpersonationHandle so that it survives multiple disposes. --- Contexts/ImpersonationHandle.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Contexts/ImpersonationHandle.cs b/Contexts/ImpersonationHandle.cs index 752e665..56ff7aa 100644 --- a/Contexts/ImpersonationHandle.cs +++ b/Contexts/ImpersonationHandle.cs @@ -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(); }