Bug 185657

Summary: [GStreamer]: Consider GstStream(Collection) as if if was not a GInitiallyUnowned
Product: WebKit Reporter: Thibault Saunier <tsaunier>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue, ews-watchlist, pnormand, tsaunier, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 185787    
Attachments:
Description Flags
[GStreamer]: Do not steal GstStreamCollection's reference to GstStream
none
Fix previously reported styling issues.
none
Fix the issue in GRefPtrGStreamer.cpp directly.
none
Spelling fixes in the ChageLog. none

Description Thibault Saunier 2018-05-15 14:27:09 PDT
See commit message.
Comment 1 Thibault Saunier 2018-05-15 14:29:43 PDT
Created attachment 340434 [details]
[GStreamer]: Do not steal GstStreamCollection's reference to GstStream

Before GStreamer 1.14[1] GstStream's reference was not sunk when creating
it, meaning that when we were using

    `GRefPtr<GstStream> stream = gst_stream_collection_get(collection, stream_index);`

we were actually calling `g_object_sink_ref(some_stream);` leading to taking
ownership of that (floating) reference, while we were not actually owning it as it was
owned by the GstStreamCollection itself. In the end we were ending up
unrefing an already destroyed object randomly later on (see bug #184581)

This patchs makes sure the floating reference is sunk (giving real ownership
to the GstStreamCollection in the end) for Gst < 1.14.

Starting from 1.14, the ref is sunk in gst_stream_new and we will not do anything
as we do not need to anymore.

[1] commit f119e93b47efb06ffc68c01d3e094d5346c30041 `gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent`
Comment 2 EWS Watchlist 2018-05-15 14:32:39 PDT
Attachment 340434 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:635:  Declaration has space between type name and * in GstStream * tmpstream  [whitespace/declaration] [3]
ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1335:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Thibault Saunier 2018-05-15 14:39:44 PDT
Created attachment 340435 [details]
Fix previously reported styling issues.
Comment 4 Philippe Normand 2018-05-16 07:48:48 PDT
Comment on attachment 340435 [details]
Fix previously reported styling issues.

I wonder if GRefPtrGStreamer.cpp could be patched instead?
Comment 5 Thibault Saunier 2018-05-16 11:11:10 PDT
Created attachment 340501 [details]
Fix the issue in GRefPtrGStreamer.cpp directly.
Comment 6 Thibault Saunier 2018-05-16 11:25:21 PDT
Created attachment 340505 [details]
Spelling fixes in the ChageLog.

[1] commit f119e93b47efb06ffc68c01d3e094d5346c30041 `gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent`
Comment 7 Philippe Normand 2018-05-16 11:47:38 PDT
Comment on attachment 340505 [details]
Spelling fixes in the ChageLog.

LGTM but I'll let Carlos check this too.
Comment 8 Carlos Garcia Campos 2018-05-16 22:58:12 PDT
Comment on attachment 340505 [details]
Spelling fixes in the ChageLog.

Ok
Comment 9 WebKit Commit Bot 2018-05-17 01:16:45 PDT
Comment on attachment 340505 [details]
Spelling fixes in the ChageLog.

Clearing flags on attachment: 340505

Committed r231891: <https://trac.webkit.org/changeset/231891>
Comment 10 WebKit Commit Bot 2018-05-17 01:16:47 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2018-05-17 01:17:19 PDT
<rdar://problem/40324459>