On Tue, Mar 8, 2011 at 5:22 PM, Christopher David Howie <m...@chrishowie.com>wrote:
> -----------------------8<----------------------- > FooDialog d; > try { > d = new FooDialog(); > d.Run(); > } finally { > if (d != null) { > d.Destroy(); > d.Dispose(); > } > } > The try/finally above accomplishes nothing. The d.Run() call results in a native transition. The only possible exception you can receive during that call would be related to an inability to pinvoke libgtk which presumably would have stopped you long before this point. Once the transition to gtk_dialog_run has occurred, no exception propagation will or can come back across the native boundary. Doing a Destroy would similarly fail pinvoke for any scenario regarding exceptions coming out of d.Run. d != null fails for dialog constructor exceptions. The Dispose call is redundant since Destroy calls Dispose. I'm assuming this Destroy+Dispose pattern evolved from people writing Dispose, finding out they really needed to Destroy instead, and forgetting or not knowing they could remove the Dispose. The above code is therefore no more robust than: var d = new FooDialog (); d.Run (); d.Destroy (); The fact that people as knowledgable with Gtk# may be writing code like that though is a somewhat convincing argument that we have an opportunity to improve the binding here. Mike
_______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/gtk-sharp-list