[MonoDevelop] What is the correct way of closing a Gtk dialog?

Mike Kestner mkestner at gmail.com
Thu May 22 15:35:39 EDT 2008

On Thu, 2008-05-22 at 11:28 -0400, Michael Hutchinson wrote:
> On Thu, May 22, 2008 at 8:41 AM, Chris Howie <cdhowie at gmail.com> wrote:
> > On Thu, May 22, 2008 at 7:15 AM, simon.n.lindgren at gmail.com
> > <simon.n.lindgren at gmail.com> wrote:
> >> I have created a dialog that I show to the user to get an input value.
> >> How do I close the dialog in the correct way when the user clicks one of
> >> the buttons in the dialog?
> >> Currently I'm using the Destroy() method but that's not correct, is it?
> >> I'm using C# and gtk-sharp.
> >
> > That is the correct way to close and dispose of all of the resources
> > associated with a GObject, yes, and it works for GTK windows too.
> > (Personally, I've always wondered why GObject doesn't implement
> > IDisposable, but that's another discussion.)
> Indeed. The confusing thing is that IDisposable IS implemented on GTK#
> widgets but doesn't call Destroy -- and sadly, this can't be changed
> without breaking backwards compatibility.

Conversely, calling Destroy does call Dispose (in most cases, and even
more with a bugfix earlier this week :-)).  Hopefully your suggested
pattern of overriding Dispose to invoke Destroy is guarded for


More information about the Monodevelop-list mailing list