diff --git a/ChangeLog b/ChangeLog index 0620731a3..f53767b40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-21 Mike Kestner + + * gtk/Object.custom (OnDestroyed): ensure Dispose runs even if + no Destroyed handlers are connected. + 2008-05-21 Mike Kestner * gtk/Application.cs (CurrentEvent): use Event.GetEvent to retrieve diff --git a/gtk/Object.custom b/gtk/Object.custom index c769cd22e..ba1289a19 100755 --- a/gtk/Object.custom +++ b/gtk/Object.custom @@ -41,12 +41,11 @@ [GLib.DefaultSignalHandler(Type=typeof(Gtk.Object), ConnectionMethod="OverrideDestroyed")] protected virtual void OnDestroyed () { - if (DestroyHandlers [Handle] == null) - return; - - EventHandler handler = (EventHandler) DestroyHandlers [Handle]; - handler (this, EventArgs.Empty); - DestroyHandlers [Handle] = null; + if (DestroyHandlers.Contains (Handle)) { + EventHandler handler = (EventHandler) DestroyHandlers [Handle]; + handler (this, EventArgs.Empty); + DestroyHandlers.Remove (Handle); + } Dispose (); }