<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GStreamer] clean-up various leaks"
href="https://bugs.webkit.org/show_bug.cgi?id=154285#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GStreamer] clean-up various leaks"
href="https://bugs.webkit.org/show_bug.cgi?id=154285">bug 154285</a>
from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=154285#c4">comment #4</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=271425&action=diff" name="attach_271425" title="patch">attachment 271425</a> <a href="attachment.cgi?id=271425&action=edit" title="patch">[details]</a></span>
> patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=271425&action=review">https://bugs.webkit.org/attachment.cgi?id=271425&action=review</a>
>
> >>> Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:196
> >>> + priv->task = adoptGRef(gst_task_new(reinterpret_cast<GstTaskFunction>(webKitWebAudioSrcLoop), src, 0));
> >>
> >> GstTask is GInitiallyUnowned, so this returns a floating reference that we should consume here, so adoptGRef is not correct. Aren't you hitting the assert in GRefPtr<GstTask> adoptGRef(GstTask* ptr) ?
> >
> > Heh. No :)
> > But I'll double-check.
>
> This should be adoptGRef(g_object_ref_sink(gst_task_new(...))), correct?</span >
No.
<span class="quote">> I think floating references are not useful in combination with GRefPtr, so
> why don't we take it always in adoptGRef() (e.g. by calling
> g_object_is_floating() and then g_object_ref_sink() if that return TRUE)?</span >
Because in that case you are not adopting the ref, but consuming the floating reference.
<span class="quote">> What is the value in asserting that the ptr is not floating? (Why do we do
> that only in GRefPtrGStreamer.cpp and not in GRefPtr.cpp?) Am I missing
> something here?</span >
Because we want to prevent misuses of GRefPtr with floating references. You should never adopt a floating reference. I think we only do this in GRefPtrGStreamer because GstObject is GInitiallyUnowned, so we know all gst classes are using floating references. Since this seems to be a bit confusing, I've tried to clarify it and written this <a href="http://trac.webkit.org/wiki/WebKitGTK/GRefPtrAndFloatingRefs">http://trac.webkit.org/wiki/WebKitGTK/GRefPtrAndFloatingRefs</a>. I hope it helps.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>