From f11bd790004bea6cdb9ebc4622111190d2625594 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Sun, 3 May 2009 22:49:12 +0000 Subject: [PATCH] 2009-05-03 Mike Kestner * glib/Object.cs: revert to old LookupType behavior when Handle is not set. [Fixes #500417] svn path=/trunk/gtk-sharp/; revision=133451 --- ChangeLog | 7 ++++++- glib/Object.cs | 10 +++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6204a2ef2..11c241171 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-05-03 Mike Kestner + + * glib/Object.cs: revert to old LookupType behavior when Handle is + not set. [Fixes #500417] + 2009-05-03 Stephane Delcroix * glib/Idle.cs: @@ -32,7 +37,7 @@ * gtk/Widget.custom: Implement signal registration for the Activate, SettScrollAdjustments and key binding signals - in managed code. + in managed code. 2009-04-25 Mike Kestner diff --git a/glib/Object.cs b/glib/Object.cs index c0e6eb8fb..61d1e61d7 100644 --- a/glib/Object.cs +++ b/glib/Object.cs @@ -323,9 +323,13 @@ namespace GLib { protected GType LookupGType () { - GTypeInstance obj = (GTypeInstance) Marshal.PtrToStructure (Handle, typeof (GTypeInstance)); - GTypeClass klass = (GTypeClass) Marshal.PtrToStructure (obj.g_class, typeof (GTypeClass)); - return new GLib.GType (klass.gtype); + if (Handle != IntPtr.Zero) { + GTypeInstance obj = (GTypeInstance) Marshal.PtrToStructure (Handle, typeof (GTypeInstance)); + GTypeClass klass = (GTypeClass) Marshal.PtrToStructure (obj.g_class, typeof (GTypeClass)); + return new GLib.GType (klass.gtype); + } else { + return LookupGType (GetType ()); + } } protected internal static GType LookupGType (System.Type t)