gst/: use gst_object_ref when setting the pad template; this will trigger the pad template leaks on GLib 2.6 and the ...

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
This commit is contained in:
Thomas Vander Stichele 2005-11-16 12:40:18 +00:00
parent 403099819f
commit d5497ccd53
4 changed files with 29 additions and 3 deletions

View file

@ -1,3 +1,11 @@
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):

View 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);
}

View 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

View 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);