Commit c2ce18e8 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

gl: Also don't leak floating references to elements set via properties

Fixup for 58ac815e. Floating references
are such a mess.
parent b99414e8
......@@ -173,7 +173,7 @@ _connect_filter_element (GstGLFilterBin * self)
}
/*
* @filter: (transfer full):
* @filter: (transfer floating):
*/
static gboolean
gst_gl_filter_bin_set_filter (GstGLFilterBin * self, GstElement * filter)
......@@ -189,10 +189,10 @@ gst_gl_filter_bin_set_filter (GstGLFilterBin * self, GstElement * filter)
}
self->filter = filter;
if (filter && g_object_is_floating (filter))
gst_object_ref_sink (filter);
gst_object_ref_sink (filter);
if (filter && !_connect_filter_element (self)) {
gst_object_unref (self->filter);
self->filter = NULL;
return FALSE;
}
......@@ -204,8 +204,7 @@ void
gst_gl_filter_bin_finish_init_with_element (GstGLFilterBin * self,
GstElement * element)
{
if (!gst_gl_filter_bin_set_filter (self, element))
gst_object_unref (element);
gst_gl_filter_bin_set_filter (self, element);
}
void
......@@ -245,7 +244,7 @@ gst_gl_filter_bin_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_FILTER:
gst_gl_filter_bin_set_filter (self, g_value_dup_object (value));
gst_gl_filter_bin_set_filter (self, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......
......@@ -399,7 +399,7 @@ _connect_mixer_element (GstGLMixerBin * self)
}
/*
* @mixer: (transfer full):
* @mixer: (transfer floating):
*/
static gboolean
gst_gl_mixer_bin_set_mixer (GstGLMixerBin * self, GstElement * mixer)
......@@ -415,10 +415,10 @@ gst_gl_mixer_bin_set_mixer (GstGLMixerBin * self, GstElement * mixer)
}
self->mixer = mixer;
if (mixer && g_object_is_floating (mixer))
gst_object_ref_sink (mixer);
gst_object_ref_sink (mixer);
if (mixer && !_connect_mixer_element (self)) {
gst_object_unref (self->mixer);
self->mixer = NULL;
return FALSE;
}
......@@ -430,8 +430,7 @@ void
gst_gl_mixer_bin_finish_init_with_element (GstGLMixerBin * self,
GstElement * element)
{
if (!gst_gl_mixer_bin_set_mixer (self, element))
gst_object_unref (element);
gst_gl_mixer_bin_set_mixer (self, element);
}
void
......@@ -473,7 +472,7 @@ gst_gl_mixer_bin_set_property (GObject * object,
switch (prop_id) {
case PROP_MIXER:
{
GstElement *mixer = g_value_dup_object (value);
GstElement *mixer = g_value_get_object (value);
/* FIXME: deal with replacing a mixer */
g_return_if_fail (!self->mixer || (self->mixer == mixer));
gst_gl_mixer_bin_set_mixer (self, mixer);
......
......@@ -307,10 +307,10 @@ gst_gl_sink_bin_set_sink (GstGLSinkBin * self, GstElement * sink)
}
self->sink = sink;
if (sink && g_object_is_floating (sink))
gst_object_ref_sink (sink);
gst_object_ref_sink (sink);
if (sink && !_connect_sink_element (self)) {
gst_object_unref (self->sink);
self->sink = NULL;
return FALSE;
}
......@@ -322,8 +322,7 @@ void
gst_gl_sink_bin_finish_init_with_element (GstGLSinkBin * self,
GstElement * element)
{
if (!gst_gl_sink_bin_set_sink (self, element))
gst_object_unref (element);
gst_gl_sink_bin_set_sink (self, element);
}
void
......@@ -347,7 +346,7 @@ gst_gl_sink_bin_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_SINK:
gst_gl_sink_bin_set_sink (self, g_value_dup_object (value));
gst_gl_sink_bin_set_sink (self, g_value_get_object (value));
break;
case PROP_CONTRAST:
case PROP_BRIGHTNESS:
......
......@@ -165,7 +165,7 @@ _connect_src_element (GstGLSrcBin * self)
}
/*
* @src: (transfer full):
* @src: (transfer floating):
*/
static gboolean
gst_gl_src_bin_set_src (GstGLSrcBin * self, GstElement * src)
......@@ -181,10 +181,10 @@ gst_gl_src_bin_set_src (GstGLSrcBin * self, GstElement * src)
}
self->src = src;
if (src && g_object_is_floating (src))
gst_object_ref_sink (src);
gst_object_ref_sink (src);
if (src && !_connect_src_element (self)) {
gst_object_unref (self->src);
self->src = NULL;
return FALSE;
}
......@@ -196,8 +196,7 @@ void
gst_gl_src_bin_finish_init_with_element (GstGLSrcBin * self,
GstElement * element)
{
if (!gst_gl_src_bin_set_src (self, element))
gst_object_unref (self->src);
gst_gl_src_bin_set_src (self, element);
}
void
......@@ -221,7 +220,7 @@ gst_gl_src_bin_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_SRC:
gst_gl_src_bin_set_src (self, g_value_dup_object (value));
gst_gl_src_bin_set_src (self, g_value_get_object (value));
break;
default:
if (self->src)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment