2005-03-03 Mike Kestner <mkestner@novell.com>

* generator/ClassBase.cs : use "as" instead of a cast in FromNative.
	* generator/Method.cs : remove the if/else checks for Object retvals.
	* glib/Object.cs : return null immediately for NULL in GetObject.

svn path=/trunk/gtk-sharp/; revision=41409
This commit is contained in:
Mike Kestner 2005-03-03 20:50:46 +00:00
parent eec84f4b5d
commit 0677e5ac75
4 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2005-03-03 Mike Kestner <mkestner@novell.com>
* generator/ClassBase.cs : use "as" instead of a cast in FromNative.
* generator/Method.cs : remove the if/else checks for Object retvals.
* glib/Object.cs : return null immediately for NULL in GetObject.
2005-03-03 Mike Kestner <mkestner@novell.com>
* generator/ClassBase.cs : add null checking to CallByName. No sense

View file

@ -164,7 +164,7 @@ namespace GtkSharp.Generation {
public override string FromNative(string var)
{
return "(" + QualifiedName + ") GLib.Object.GetObject(" + var + ")";
return "GLib.Object.GetObject(" + var + ") as " + QualifiedName;
}
protected void GenProperties (GenerationInfo gen_info)

View file

@ -327,7 +327,7 @@ namespace GtkSharp.Generation {
sw.Write(indent + "\t\t\t");
if (retval.MarshalType == "void") {
sw.WriteLine(CName + call + ";");
} else if (ret_igen is ObjectGen || ret_igen is OpaqueGen) {
} else if (ret_igen is OpaqueGen) {
sw.WriteLine(retval.MarshalType + " raw_ret = " + CName + call + ";");
sw.WriteLine(indent +"\t\t\t" + retval.CSType + " ret;");
sw.WriteLine(indent + "\t\t\tif (raw_ret == IntPtr.Zero)");

View file

@ -91,6 +91,9 @@ namespace GLib {
public static Object GetObject(IntPtr o, bool owned_ref)
{
if (o == IntPtr.Zero)
return null;
Object obj;
WeakReference weak_ref = Objects[o] as WeakReference;
if (weak_ref != null && weak_ref.IsAlive) {