glbasefilter: Unref other context in finalize, and display in READY->NULL

https://bugzilla.gnome.org/show_bug.cgi?id=748405
This commit is contained in:
Matthew Waters 2015-04-26 20:33:41 +02:00 committed by Tim-Philipp Müller
parent 4e05044734
commit db3bd840b9

View file

@ -56,6 +56,7 @@ 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);
@ -88,6 +89,7 @@ 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;
@ -115,6 +117,19 @@ 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)
@ -273,16 +288,6 @@ gst_gl_base_filter_reset (GstGLBaseFilter * filter)
gst_object_unref (filter->context);
filter->context = NULL;
}
if (filter->display) {
gst_object_unref (filter->display);
filter->display = NULL;
}
if (filter->priv->other_context) {
gst_object_unref (filter->priv->other_context);
filter->priv->other_context = NULL;
}
}
static gboolean
@ -418,6 +423,12 @@ gst_gl_base_filter_change_state (GstElement * element,
return ret;
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
if (filter->display) {
gst_object_unref (filter->display);
filter->display = NULL;
}
break;
default:
break;
}