protected virtual void Dispose(bool disposing) { ToggleRef tref; lock (Objects) { if (Objects.TryGetValue(Handle, out tref)) { tref.QueueUnref(); Objects.Remove(Handle); } } handle = IntPtr.Zero; if (tref == null) { return; } if (disposing) { tref.Free(); } else { tref.QueueUnref(); } }
public virtual void Dispose() { if (Handle == IntPtr.Zero) { return; } lock (Objects) { Objects.Remove(Handle); try { if (tref != null) { tref.Free(); tref = null; } } catch (Exception e) { Console.WriteLine("Exception while disposing a " + this + " in Gtk#"); throw e; } } handle = IntPtr.Zero; GC.SuppressFinalize(this); }
public virtual void Dispose() { if (disposed) { return; } disposed = true; ToggleRef toggle_ref = Objects [Handle] as ToggleRef; Objects.Remove(Handle); try { if (toggle_ref != null) { toggle_ref.Free(); } } catch (Exception e) { Console.WriteLine("Exception while disposing a " + this + " in Gtk#"); throw e; } handle = IntPtr.Zero; GC.SuppressFinalize(this); }