Add a gst_clear_object (similar to g_clear_object)
@nielsdg
Submitted by Niels De Graef Link to original bug (#793294)
Description
Right now, to unref a GstObject, you have multiple options:
(1) Check for !NULL and use gst_object_unref
(2) Use g_object_unref
-- but this doesn't do any kind refcount logging
(3) Use g_clear_object
-- but has the same problem as (2)
(4) Use g_clear_pointer with gst_object_unref()
In this bug, I propose a new gst_clear_object ()
macro, which is analoguous to g_clear_object
and basically expands to g_clear_pointer (obj, gst_object_unref)
. That way, we have the advantages of (3) and (4) combined into one.