GNOME Bugzilla – Bug 793294
Add a gst_clear_object (similar to g_clear_object)
Last modified: 2018-11-03 12:44:51 UTC
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.
Do you want to provide a patch for this?
Created attachment 368158 [details] [review] GstObject: add gst_clear_object() Disclaimer: I haven't been able to test this (yet). Most of the code is almost identical to the definition of g_clear_object()
(In reply to Niels De Graef from comment #0) > (2) Use `g_object_unref` -- but this doesn't do any kind refcount logging I think this logging is un-reliable (just think of bindings), so it should not be a good argument to add more API.
It's easy enough to add and features we include (the leak tracer) are depending on this, or not?
(In reply to Sebastian Dröge (slomo) from comment #4) > It's easy enough to add and features we include (the leak tracer) are > depending on this, or not? Yes, it basically falls back to g_object_unref(), so whatever you add/remove there will be executed by gst_clear_object() also. Just wanted to ask: if this get submitted, would there be interested for similar functions? (e.g. gst_clear_mini_object(), gst_clear_caps(), ...)
interest*
and of course it falls back to gst_object_unref(), not g_object_unref().This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.
Sorry about the bug change, Friday morning doesn't work too well for me.
So, does this patch make sense to you guys? :-)
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/275.