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

Fixup for 58ac815eae. Floating references
are such a mess.
This commit is contained in:
Sebastian Dröge 2018-07-25 15:03:59 +03:00
parent 58ac815eae
commit c2a7c93840
4 changed files with 19 additions and 23 deletions

View file

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

View file

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

View file

@ -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:

View file

@ -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)