msdk: Clear reference counted object in dispose() method

Follow GObject's memory management model
This commit is contained in:
Seungha Yang 2020-01-29 14:02:09 +09:00
parent 62ac77e620
commit a8fff639c8
3 changed files with 17 additions and 8 deletions

View file

@ -1629,6 +1629,16 @@ gst_msdkdec_get_property (GObject * object, guint prop_id, GValue * value,
GST_OBJECT_UNLOCK (thiz);
}
static void
gst_msdkdec_dispose (GObject * object)
{
GstMsdkDec *thiz = GST_MSDKDEC (object);
g_clear_object (&thiz->adapter);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_msdkdec_finalize (GObject * object)
{
@ -1636,7 +1646,6 @@ gst_msdkdec_finalize (GObject * object)
g_array_unref (thiz->tasks);
thiz->tasks = NULL;
g_clear_object (&thiz->adapter);
/* NULL is the empty list. */
if (G_UNLIKELY (thiz->decoded_msdk_surfaces != NULL)) {
@ -1705,6 +1714,7 @@ gst_msdkdec_class_init (GstMsdkDecClass * klass)
gobject_class->set_property = gst_msdkdec_set_property;
gobject_class->get_property = gst_msdkdec_get_property;
gobject_class->dispose = gst_msdkdec_dispose;
gobject_class->finalize = gst_msdkdec_finalize;
element_class->set_context = gst_msdkdec_set_context;

View file

@ -1778,9 +1778,8 @@ gst_msdkenc_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
query);
}
static void
gst_msdkenc_finalize (GObject * object)
gst_msdkenc_dispose (GObject * object)
{
GstMsdkEnc *thiz = GST_MSDKENC (object);
@ -1792,7 +1791,7 @@ gst_msdkenc_finalize (GObject * object)
gst_clear_object (&thiz->msdk_converted_pool);
gst_clear_object (&thiz->old_context);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static gboolean
@ -1844,7 +1843,7 @@ gst_msdkenc_class_init (GstMsdkEncClass * klass)
klass->need_reconfig = gst_msdkenc_need_reconfig;
klass->set_extra_params = gst_msdkenc_set_extra_params;
gobject_class->finalize = gst_msdkenc_finalize;
gobject_class->dispose = gst_msdkenc_dispose;
element_class->set_context = gst_msdkenc_set_context;

View file

@ -1485,13 +1485,13 @@ gst_msdkvpp_get_property (GObject * object, guint prop_id,
}
static void
gst_msdkvpp_finalize (GObject * object)
gst_msdkvpp_dispose (GObject * object)
{
GstMsdkVPP *thiz = GST_MSDKVPP (object);
gst_clear_object (&thiz->old_context);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
@ -1523,7 +1523,7 @@ gst_msdkvpp_class_init (GstMsdkVPPClass * klass)
gobject_class->set_property = gst_msdkvpp_set_property;
gobject_class->get_property = gst_msdkvpp_get_property;
gobject_class->finalize = gst_msdkvpp_finalize;
gobject_class->dispose = gst_msdkvpp_dispose;
element_class->set_context = gst_msdkvpp_set_context;