X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=gst%2Fgstminiobject.c;h=d5c28baa1166a5250dfa637ca2cd51bf8b0ced43;hb=e6bd5b41935f125bf43e030dcb909c3537d33b31;hp=251d5262cea8a0e8525e53c36b772d5bb774794b;hpb=6fa351407a06593ace25e64602b7703d282bd5c7;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c index 251d526..d5c28ba 100644 --- a/gst/gstminiobject.c +++ b/gst/gstminiobject.c @@ -506,7 +506,12 @@ remove_notify (GstMiniObject * object, gint index) /* remove item */ priv_data->n_qdata--; - if (index != priv_data->n_qdata) { + if (priv_data->n_qdata == 0) { + /* we don't shrink but free when everything is gone */ + g_free (priv_data->qdata); + priv_data->qdata = NULL; + priv_data->n_qdata_len = 0; + } else if (index != priv_data->n_qdata) { QDATA (priv_data, index) = QDATA (priv_data, priv_data->n_qdata); } } @@ -669,6 +674,30 @@ gst_mini_object_unref (GstMiniObject * mini_object) } /** + * gst_clear_mini_object: (skip) + * @object_ptr: a pointer to a #GstMiniObject reference + * + * Clears a reference to a #GstMiniObject. + * + * @object_ptr must not be %NULL. + * + * If the reference is %NULL then this function does nothing. + * Otherwise, the reference count of the object is decreased using + * gst_mini_object_unref() and the pointer is set to %NULL. + * + * A macro is also included that allows this function to be used without + * pointer casts. + * + * Since: 1.16 + **/ +#undef gst_clear_mini_object +void +gst_clear_mini_object (GstMiniObject ** object_ptr) +{ + g_clear_pointer (object_ptr, gst_mini_object_unref); +} + +/** * gst_mini_object_replace: * @olddata: (inout) (transfer full) (nullable): pointer to a pointer to a * mini-object to be replaced