From 303724d40040b23d6a86ba31b4b4c8067c250efa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 22 Apr 2009 12:46:28 +0200 Subject: [PATCH] Use the copy-on-unref workaround for newly created Application/Element/Custom messages --- gstreamer-sharp/Message.custom | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gstreamer-sharp/Message.custom b/gstreamer-sharp/Message.custom index dba3f0f..d48f813 100644 --- a/gstreamer-sharp/Message.custom +++ b/gstreamer-sharp/Message.custom @@ -708,7 +708,9 @@ static extern IntPtr gst_message_new_application (IntPtr src, IntPtr structure); static extern IntPtr gst_structure_copy (IntPtr handle); public static Message NewApplication (Gst.Object src, Gst.Structure structure) { - Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_application (src.Handle, (structure != null) ? gst_structure_copy (structure.Handle) : IntPtr.Zero), typeof (Message), true); + Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_application (src.Handle, (structure != null) ? structure.Handle : IntPtr.Zero), typeof (Message), true); + msg.cached_structure = structure; + structure.FreeNative = false; return msg; } @@ -717,7 +719,9 @@ public static Message NewApplication (Gst.Object src, Gst.Structure structure) { static extern IntPtr gst_message_new_element (IntPtr src, IntPtr structure); public static Message NewElement (Gst.Object src, Gst.Structure structure) { - Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_element (src.Handle, (structure != null) ? gst_structure_copy (structure.Handle) : IntPtr.Zero), typeof (Message), true); + Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_element (src.Handle, (structure != null) ? structure.Handle : IntPtr.Zero), typeof (Message), true); + msg.cached_structure = structure; + structure.FreeNative = false; return msg; } @@ -726,7 +730,9 @@ public static Message NewElement (Gst.Object src, Gst.Structure structure) { static extern IntPtr gst_message_new_custom (Gst.MessageType type, IntPtr src, IntPtr structure); public static Message NewCustom (Gst.MessageType type, Gst.Object src, Gst.Structure structure) { - Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_custom (type, src.Handle, (structure != null) ? gst_structure_copy (structure.Handle) : IntPtr.Zero), typeof (Message), true); + Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_custom (type, src.Handle, (structure != null) ? structure.Handle : IntPtr.Zero), typeof (Message), true); + msg.cached_structure = structure; + structure.FreeNative = false; return msg; } -- 2.7.4