RESOLVED FIXED Bug 220463
[GStreamer] Clean-up the TextCombiner
https://bugs.webkit.org/show_bug.cgi?id=220463
Summary [GStreamer] Clean-up the TextCombiner
Philippe Normand
Reported 2021-01-08 08:01:54 PST
Coding style does not conform WebKit's, and it should use the WEBKIT_DEFINE_TYPE machinery.
Attachments
Patch (33.74 KB, patch)
2021-01-11 08:37 PST, Philippe Normand
no flags
Patch (33.88 KB, patch)
2021-01-14 07:58 PST, Philippe Normand
calvaris: review+
calvaris: commit-queue-
Philippe Normand
Comment 1 2021-01-11 08:37:55 PST
Xabier Rodríguez Calvar
Comment 2 2021-01-12 07:57:43 PST
Comment on attachment 417382 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417382&action=review > Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp:121 > + auto internalPad = adoptGRef(gst_element_request_pad(combiner->priv->combinerElement.get(), templ, name, caps)); > + g_object_set(WEBKIT_TEXT_COMBINER_PAD(ghostPad), "inner-combiner-pad", internalPad.leakRef(), nullptr); You're probably astonished that I tell you this but I don't think you need to create a smart ptr to just release it in the next line. > Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp:142 > + gst_element_release_request_pad(combiner->priv->combinerElement.get(), webKitTextCombinerPadLeakInternalPadRef(combinerPad)); Aren't we leaking here? gst_element_release_request_pad doc says "This does not unref the pad. If the pad was created by using gst_element_request_pad(), gst_element_release_request_pad() needs to be followed by gst_object_unref() to free the pad." > Source/WebCore/platform/graphics/gstreamer/TextCombinerPadGStreamer.cpp:32 > +#include "GStreamerCommon.h" You don't need this if you include it in the header. > Source/WebCore/platform/graphics/gstreamer/TextCombinerPadGStreamer.h:31 > +#include "GRefPtrGStreamer.h" GStreamerCommon.h?
Philippe Normand
Comment 3 2021-01-12 08:13:55 PST
Comment on attachment 417382 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417382&action=review >> Source/WebCore/platform/graphics/gstreamer/TextCombinerPadGStreamer.h:31 >> +#include "GRefPtrGStreamer.h" > > GStreamerCommon.h? I was profiling the impact of including that header recently, here it adds a 2 seconds wall-time overhead. So unless really needed I now prefer to not include it directly, there is a way to reduce the impact it has but this is another rabbit hole :)
Philippe Normand
Comment 4 2021-01-14 07:58:46 PST
Xabier Rodríguez Calvar
Comment 5 2021-01-14 09:15:52 PST
Comment on attachment 417620 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417620&action=review > Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp:142 > + auto* internalPad = webKitTextCombinerPadLeakInternalPadRef(combinerPad); > + gst_element_release_request_pad(combiner->priv->combinerElement.get(), internalPad); > + gst_object_unref(internalPad); Nit: I would adopt it here not unref. I would try to avoid manual unrefs as much as possible cause they can lead to leaks if we change the code around and forget to call it when it is due.
Philippe Normand
Comment 6 2021-01-15 01:27:32 PST
Radar WebKit Bug Importer
Comment 7 2021-01-15 01:28:14 PST
Note You need to log in before you can comment on or make changes to this bug.