Пример #1
0
 private void DisposeCore(bool disposing)
 {
     if (Interlocked.Exchange(ref this.isDisposed, 1) == 0)
     {
         try
         {
             this.Dispose(disposing);
         }
         finally
         {
             IObjectRef innerRef = this.innerRef;
             this.InnerRef = null;
             if ((this.proxyOptions & ObjectRefProxyOptions.DoNotCreateRef) != ObjectRefProxyOptions.DoNotCreateRef)
             {
                 IRefTrackedObject obj2 = innerRef as IRefTrackedObject;
                 if (obj2 != null)
                 {
                     obj2.ReleaseRef(this, disposing);
                 }
             }
         }
         if (disposing)
         {
             RefTrackedObject cleanupContainer;
             ObjectRefProxy proxy = this;
             lock (proxy)
             {
                 cleanupContainer = this.cleanupContainer;
                 this.cleanupContainer = null;
             }
             DisposableUtil.Free<RefTrackedObject>(ref cleanupContainer, disposing);
         }
     }
 }