2008-04-08 Marek Habersack <mhabersack@novell.com>

* generator/InterfaceGen.cs: added a check for null obj in the
	generated GetObject method.

svn path=/trunk/gtk-sharp/; revision=100145
This commit is contained in:
Marek Habersack 2008-04-08 20:59:34 +00:00
parent 28a6603695
commit 20d764bb6f
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-04-08 Marek Habersack <mhabersack@novell.com>
* generator/InterfaceGen.cs: added a check for null obj in the
generated GetObject method.
2008-04-04 Mike Kestner <mkestner@novell.com>
* atk/Atk.metadata: add a few more owned refs.

View File

@ -209,7 +209,9 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\tpublic static " + Name + " GetObject (IntPtr handle, bool owned)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tGLib.Object obj = GLib.Object.GetObject (handle, owned);");
sw.WriteLine ("\t\t\tif (obj is " + Name + "Implementor)");
sw.WriteLine ("\t\t\tif (obj == null)");
sw.WriteLine ("\t\t\t\treturn null;");
sw.WriteLine ("\t\t\telse if (obj is " + Name + "Implementor)");
sw.WriteLine ("\t\t\t\treturn new {0}Adapter (obj as {0}Implementor);", Name);
sw.WriteLine ("\t\t\telse if (obj as " + Name + " == null)");
sw.WriteLine ("\t\t\t\treturn new {0}Adapter (obj.Handle);", Name);