gst/: use gst_object_ref when setting the pad template; this will trigger the pad...
authorThomas Vander Stichele <thomas@apestaart.org>
Wed, 16 Nov 2005 12:40:18 +0000 (12:40 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Wed, 16 Nov 2005 12:40:18 +0000 (12:40 +0000)
Original commit message from CVS:

* gst/glib-compat.c: (g_value_dup_gst_object):
* gst/glib-compat.h:
* gst/gstpad.c: (gst_pad_set_property):
use gst_object_ref when setting the pad template; this will
trigger the pad template leaks on GLib 2.6 and the slaves

ChangeLog
gst/glib-compat.c
gst/glib-compat.h
gst/gstpad.c

index 8aee3bb..24eb7f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2005-11-16  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+       * gst/glib-compat.c: (g_value_dup_gst_object):
+       * gst/glib-compat.h:
+       * gst/gstpad.c: (gst_pad_set_property):
+         use gst_object_ref when setting the pad template; this will
+         trigger the pad template leaks on GLib 2.6 and the slaves
+
+2005-11-16  Thomas Vander Stichele  <thomas at apestaart dot org>
+
        * gst/glib-compat.c: (gst_flags_get_first_value):
        * gst/glib-compat.h:
        * gst/gstregistryxml.c:
index 9272a5f..4dc9515 100644 (file)
@@ -28,9 +28,7 @@
 #include "config.h"
 
 #include <glib.h>
-#if GLIB_CHECK_VERSION (2, 6, 0)
 #include <glib/gstdio.h>
-#endif
 
 #include <stdio.h>
 #include <errno.h>
@@ -170,3 +168,19 @@ gst_flags_get_first_value (GFlagsClass * flags_class, guint value)
 
   return NULL;
 }
+
+/* Adapted from g_value_dup_object to use gst_object_ref */
+#include "gstobject.h"
+GObject *
+g_value_dup_gst_object (const GValue * value)
+{
+  GObject *o;
+
+  g_return_val_if_fail (G_VALUE_HOLDS_OBJECT (value), NULL);
+
+  o = value->data[0].v_pointer;
+  if (!o)
+    return NULL;
+  g_return_val_if_fail (GST_IS_OBJECT (o), NULL);
+  return gst_object_ref (o);
+}
index 2658ad7..74d669f 100644 (file)
@@ -20,5 +20,8 @@ int g_mkdir_with_parents (const gchar *pathname, int          mode);
 GFlagsValue*
 gst_flags_get_first_value (GFlagsClass *flags_class,
                            guint        value);
+
+GObject*
+g_value_dup_gst_object (const GValue *value);
 G_END_DECLS
 
index 2a95305..ca3529c 100644 (file)
@@ -71,6 +71,7 @@
 #include "gstinfo.h"
 #include "gsterror.h"
 #include "gstvalue.h"
+#include "glib-compat.h"
 
 GST_DEBUG_CATEGORY_STATIC (debug_dataflow);
 #define GST_CAT_DEFAULT GST_CAT_PADS
@@ -418,7 +419,7 @@ gst_pad_set_property (GObject * object, guint prop_id,
       break;
     case PAD_PROP_TEMPLATE:
       gst_pad_set_pad_template (GST_PAD_CAST (object),
-          (GstPadTemplate *) g_value_dup_object (value));
+          (GstPadTemplate *) g_value_dup_gst_object (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);