Commit bd940327 authored by Matthew Waters's avatar Matthew Waters 🐨

gl: unref display/other-context in the correct place

Otherwise state changes from PLAYING->READY->PAUSED will cause there to
to be no display configured on the element.

https://bugzilla.gnome.org/show_bug.cgi?id=748405
parent 989643ff
......@@ -247,8 +247,6 @@ static gboolean gst_gl_base_mixer_set_allocation (GstGLBaseMixer * mix,
GstBufferPool * pool, GstAllocator * allocator,
GstAllocationParams * params, GstQuery * query);
static void gst_gl_base_mixer_finalize (GObject * object);
static void
gst_gl_base_mixer_class_init (GstGLBaseMixerClass * klass)
{
......@@ -266,8 +264,6 @@ gst_gl_base_mixer_class_init (GstGLBaseMixerClass * klass)
g_type_class_add_private (klass, sizeof (GstGLBaseMixerPrivate));
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_gl_base_mixer_finalize);
gobject_class->get_property = gst_gl_base_mixer_get_property;
gobject_class->set_property = gst_gl_base_mixer_set_property;
......@@ -313,19 +309,6 @@ gst_gl_base_mixer_init (GstGLBaseMixer * mix)
gst_gl_base_mixer_reset (mix);
}
static void
gst_gl_base_mixer_finalize (GObject * object)
{
GstGLBaseMixer *mix = GST_GL_BASE_MIXER (object);
if (mix->priv->other_context) {
gst_object_unref (mix->priv->other_context);
mix->priv->other_context = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_gl_base_mixer_set_context (GstElement * element, GstContext * context)
{
......@@ -674,11 +657,6 @@ gst_gl_base_mixer_stop (GstAggregator * agg)
mix->priv->pool = NULL;
}
if (mix->display) {
gst_object_unref (mix->display);
mix->display = NULL;
}
if (mix->context) {
gst_object_unref (mix->context);
mix->context = NULL;
......@@ -717,6 +695,17 @@ gst_gl_base_mixer_change_state (GstElement * element, GstStateChange transition)
return ret;
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
if (mix->priv->other_context) {
gst_object_unref (mix->priv->other_context);
mix->priv->other_context = NULL;
}
if (mix->display) {
gst_object_unref (mix->display);
mix->display = NULL;
}
break;
default:
break;
}
......
......@@ -624,11 +624,6 @@ gst_glimage_sink_finalize (GObject * object)
g_mutex_clear (&glimage_sink->drawing_lock);
if (glimage_sink->other_context) {
gst_object_unref (glimage_sink->other_context);
glimage_sink->other_context = NULL;
}
g_free (glimage_sink->display_name);
GST_DEBUG ("finalized");
......@@ -971,6 +966,11 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
break;
}
case GST_STATE_CHANGE_READY_TO_NULL:
if (glimage_sink->other_context) {
gst_object_unref (glimage_sink->other_context);
glimage_sink->other_context = NULL;
}
if (glimage_sink->display) {
gst_object_unref (glimage_sink->display);
glimage_sink->display = NULL;
......
......@@ -80,7 +80,6 @@ static void gst_gl_test_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_gl_test_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_gl_test_src_dispose (GObject * object);
static gboolean gst_gl_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
static GstCaps *gst_gl_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter);
......@@ -156,7 +155,6 @@ gst_gl_test_src_class_init (GstGLTestSrcClass * klass)
gobject_class->set_property = gst_gl_test_src_set_property;
gobject_class->get_property = gst_gl_test_src_get_property;
gobject_class->dispose = gst_gl_test_src_dispose;
g_object_class_install_property (gobject_class, PROP_PATTERN,
g_param_spec_enum ("pattern", "Pattern",
......@@ -386,18 +384,6 @@ gst_gl_test_src_set_pattern (GstGLTestSrc * gltestsrc, gint pattern_type)
}
}
static void
gst_gl_test_src_dispose (GObject * object)
{
GstGLTestSrc *src = GST_GL_TEST_SRC (object);
if (src->other_context)
gst_object_unref (src->other_context);
src->other_context = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_gl_test_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
......@@ -749,11 +735,6 @@ gst_gl_test_src_stop (GstBaseSrc * basesrc)
src->context = NULL;
}
if (src->display) {
gst_object_unref (src->display);
src->display = NULL;
}
return TRUE;
}
......@@ -934,6 +915,17 @@ gst_gl_test_src_change_state (GstElement * element, GstStateChange transition)
return ret;
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
if (src->other_context) {
gst_object_unref (src->other_context);
src->other_context = NULL;
}
if (src->display) {
gst_object_unref (src->display);
src->display = NULL;
}
break;
default:
break;
}
......
......@@ -56,7 +56,6 @@ static void gst_gl_base_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_gl_base_filter_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_gl_base_filter_finalize (GObject * object);
static void gst_gl_base_filter_set_context (GstElement * element,
GstContext * context);
......@@ -89,7 +88,6 @@ gst_gl_base_filter_class_init (GstGLBaseFilterClass * klass)
gobject_class->set_property = gst_gl_base_filter_set_property;
gobject_class->get_property = gst_gl_base_filter_get_property;
gobject_class->finalize = gst_gl_base_filter_finalize;
GST_BASE_TRANSFORM_CLASS (klass)->query = gst_gl_base_filter_query;
GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_base_filter_start;
......@@ -117,19 +115,6 @@ gst_gl_base_filter_init (GstGLBaseFilter * filter)
filter->priv = GST_GL_BASE_FILTER_GET_PRIVATE (filter);
}
static void
gst_gl_base_filter_finalize (GObject * object)
{
GstGLBaseFilter *filter = GST_GL_BASE_FILTER (object);
if (filter->priv->other_context) {
gst_object_unref (filter->priv->other_context);
filter->priv->other_context = NULL;
}
G_OBJECT_CLASS (gst_gl_base_filter_parent_class)->finalize (object);
}
static void
gst_gl_base_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
......@@ -424,6 +409,11 @@ gst_gl_base_filter_change_state (GstElement * element,
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
if (filter->priv->other_context) {
gst_object_unref (filter->priv->other_context);
filter->priv->other_context = NULL;
}
if (filter->display) {
gst_object_unref (filter->display);
filter->display = NULL;
......
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