DynamicSignal: use NativeType property instead of doing unsafe pointer trickery
authorErlend Graff <erlend@pexip.com>
Mon, 18 Sep 2017 13:28:29 +0000 (15:28 +0200)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Mon, 25 Sep 2017 17:16:25 +0000 (14:16 -0300)
(which doesn't work with MS csc)

https://bugzilla.gnome.org/show_bug.cgi?id=788132

sources/custom/DynamicSignal.cs

index 1ba5b7305f93c69292872a4e38d8a7a08797f3ed..47998f64ab9b98daba4bb957af7c34b455c97171 100644 (file)
@@ -329,12 +329,8 @@ namespace Gst
                public static object Emit (GLib.Object o, string name, params object[] parameters)
                {
                        SignalQuery query;
-                       IntPtr type;
-                       unsafe {
-                               // GType is the first field of GTypeInstance->g_class
-                               type = (*(IntPtr*) ((GLib.Object.GTypeInstance*) o.Handle)->g_class);
-                       }
-                       GType gtype = new GType (type);
+                       GType gtype = o.NativeType;
+                       IntPtr type = gtype.Val;
                        string signal_name, signal_detail;
                        uint signal_detail_quark = 0;
                        int colon;
@@ -451,4 +447,4 @@ namespace Gst
                [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
                static extern void g_signal_query (uint signal_id, ref GSignalQuery query);
        }
-}
\ No newline at end of file
+}