Exemplo n.º 1
0
 public void Dispose()
 {
     if (this.IsAllocated)
     {
         this.IsAllocated = false;
         if (!this.PinnedCallback.IsAllocated)
         {
             throw new Exception("Callback isn't allocated!?");
         }
         SteamClient.UnregisterCallback(this.PinnedCallback.AddrOfPinnedObject());
         foreach (GCHandle allocation in this.Allocations)
         {
             if (allocation.IsAllocated)
             {
                 allocation.Free();
             }
         }
         this.Allocations = null;
         this.PinnedCallback.Free();
         if (this.vTablePtr != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(this.vTablePtr);
             this.vTablePtr = IntPtr.Zero;
         }
     }
 }
Exemplo n.º 2
0
        public void Dispose()
        {
            if (!IsAllocated)
            {
                return;
            }
            IsAllocated = false;

            if (!PinnedCallback.IsAllocated)
            {
                throw new System.Exception("Callback isn't allocated!?");
            }

            SteamClient.UnregisterCallback(PinnedCallback.AddrOfPinnedObject());

            foreach (var a in Allocations)
            {
                if (a.IsAllocated)
                {
                    a.Free();
                }
            }

            Allocations = null;

            PinnedCallback.Free();

            if (vTablePtr != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(vTablePtr);
                vTablePtr = IntPtr.Zero;
            }
        }