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

Chris Howie cdhowie at gmail.com
Thu May 22 11:31:19 EDT 2008

On Thu, May 22, 2008 at 11:28 AM, Michael Hutchinson
<m.j.hutchinson at gmail.com> wrote:
>> 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.
> However, this needn't be the case for new widgets. The first thing I
> do when subclassing Dialog is to override Dispose with a version that
> calls Destroy. Then I can use the 'using' pattern:
> using (MyDialog dialog = new MyDialog ()) {
>    somevalue = dialog.Run ();
> }

And this, ladies and gentlemen, is why having preprocessor macros is a

Chris Howie

More information about the Monodevelop-list mailing list