Title: [173959] releases/WebKitGTK/webkit-2.4/Source/WebCore
Revision
173959
Author
[email protected]
Date
2014-09-25 06:46:47 -0700 (Thu, 25 Sep 2014)

Log Message

Merge r172928 - [GStreamer] ASSERT failure in WebKitWebSource in StreamingClient
https://bugs.webkit.org/show_bug.cgi?id=136132

adoptGRef() has an ASSERT failure if it's used on a floating pointer. For some reason,
WebKitWebSrc* src in StreamingClient's constructor is floating. Since we
don't construct this ourselves, I assume this is happening in Playbin.

If we remove the ref and adopt, GRefPtr's constructor calls gst_object_ref_sink,
which removes the floating reference and doesn't increment the reference count.
This should work, but actually causes the page to either lock up or crash (different
results for different testers).

In this case, it seems like the adoptGRef / gst_object_ref was the correct thing to do,
but adoptGRef won't actually let us do. Removing the ASSERT is a bad idea, because
usually we don't want to adopt floating pointers.

This is all a long way of saying that making m_src a raw pointer and manually
calling gst_object_ref(), and calling gst_object_unref in the destructor is the
best solution in this case, since it fixes the problem while leaving the ASSERT
to protect us in the much more common case where adopting a floating reference is bad.

Reviewed by Philippe Normand.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(StreamingClient::StreamingClient): Make m_src a raw pointer instead of a GRefPtr.
(StreamingClient::~StreamingClient): Unref m_src.
(StreamingClient::createReadBuffer): Replace m_src.get() with m_src, since it's a raw pointer now.
(StreamingClient::handleResponseReceived): Same.
(StreamingClient::handleDataReceived): Same.
(StreamingClient::handleNotifyFinished): Same.
(CachedResourceStreamingClient::notifyFinished): Same.
(ResourceHandleStreamingClient::didFail): Same.
(ResourceHandleStreamingClient::wasBlocked): Same.
(ResourceHandleStreamingClient::cannotShowURL): Same.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (173958 => 173959)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2014-09-25 13:39:11 UTC (rev 173958)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2014-09-25 13:46:47 UTC (rev 173959)
@@ -1,3 +1,40 @@
+2014-08-25  Brendan Long  <[email protected]>
+
+        [GStreamer] ASSERT failure in WebKitWebSource in StreamingClient
+        https://bugs.webkit.org/show_bug.cgi?id=136132
+
+        adoptGRef() has an ASSERT failure if it's used on a floating pointer. For some reason,
+        WebKitWebSrc* src in StreamingClient's constructor is floating. Since we
+        don't construct this ourselves, I assume this is happening in Playbin.
+
+        If we remove the ref and adopt, GRefPtr's constructor calls gst_object_ref_sink,
+        which removes the floating reference and doesn't increment the reference count.
+        This should work, but actually causes the page to either lock up or crash (different
+        results for different testers).
+
+        In this case, it seems like the adoptGRef / gst_object_ref was the correct thing to do,
+        but adoptGRef won't actually let us do. Removing the ASSERT is a bad idea, because
+        usually we don't want to adopt floating pointers.
+
+        This is all a long way of saying that making m_src a raw pointer and manually
+        calling gst_object_ref(), and calling gst_object_unref in the destructor is the
+        best solution in this case, since it fixes the problem while leaving the ASSERT
+        to protect us in the much more common case where adopting a floating reference is bad.
+
+        Reviewed by Philippe Normand.
+
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (StreamingClient::StreamingClient): Make m_src a raw pointer instead of a GRefPtr.
+        (StreamingClient::~StreamingClient): Unref m_src.
+        (StreamingClient::createReadBuffer): Replace m_src.get() with m_src, since it's a raw pointer now.
+        (StreamingClient::handleResponseReceived): Same.
+        (StreamingClient::handleDataReceived): Same.
+        (StreamingClient::handleNotifyFinished): Same.
+        (CachedResourceStreamingClient::notifyFinished): Same.
+        (ResourceHandleStreamingClient::didFail): Same.
+        (ResourceHandleStreamingClient::wasBlocked): Same.
+        (ResourceHandleStreamingClient::cannotShowURL): Same.
+
 2014-08-24  Michael Catanzaro  <[email protected]>
 
         [GTK] Toggle buttons visually broken with GTK+ 3.13.7

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (173958 => 173959)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2014-09-25 13:39:11 UTC (rev 173958)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2014-09-25 13:46:47 UTC (rev 173959)
@@ -69,7 +69,7 @@
         void handleDataReceived(const char*, int);
         void handleNotifyFinished();
 
-        GRefPtr<GstElement> m_src;
+        GstElement* m_src;
 };
 
 class CachedResourceStreamingClient : public CachedRawResourceClient, public StreamingClient {
@@ -821,17 +821,18 @@
 }
 
 StreamingClient::StreamingClient(WebKitWebSrc* src)
-    : m_src(adoptGRef(static_cast<GstElement*>(gst_object_ref(src))))
+    : m_src(static_cast<GstElement*>(gst_object_ref(src)))
 {
 }
 
 StreamingClient::~StreamingClient()
 {
+    gst_object_unref(m_src);
 }
 
 char* StreamingClient::createReadBuffer(size_t requestedSize, size_t& actualSize)
 {
-    WebKitWebSrc* src = ""
+    WebKitWebSrc* src = ""
     WebKitWebSrcPrivate* priv = src->priv;
 
     ASSERT(!priv->buffer);
@@ -850,7 +851,7 @@
 
 void StreamingClient::handleResponseReceived(const ResourceResponse& response, CORSAccessCheckResult corsAccessCheck)
 {
-    WebKitWebSrc* src = ""
+    WebKitWebSrc* src = ""
     WebKitWebSrcPrivate* priv = src->priv;
 
     GST_DEBUG_OBJECT(src, "Received response: %d", response.httpStatusCode());
@@ -962,7 +963,7 @@
 
 void StreamingClient::handleDataReceived(const char* data, int length)
 {
-    WebKitWebSrc* src = ""
+    WebKitWebSrc* src = ""
     WebKitWebSrcPrivate* priv = src->priv;
 
     GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
@@ -1029,7 +1030,7 @@
 
 void StreamingClient::handleNotifyFinished()
 {
-    WebKitWebSrc* src = ""
+    WebKitWebSrc* src = ""
     WebKitWebSrcPrivate* priv = src->priv;
 
     GST_DEBUG_OBJECT(src, "Have EOS");
@@ -1102,7 +1103,7 @@
 void CachedResourceStreamingClient::notifyFinished(CachedResource* resource)
 {
     if (resource->loadFailedOrCanceled()) {
-        WebKitWebSrc* src = ""
+        WebKitWebSrc* src = ""
 
         if (!resource->wasCanceled()) {
             const ResourceError& error = resource->resourceError();
@@ -1179,7 +1180,7 @@
 
 void ResourceHandleStreamingClient::didFail(ResourceHandle*, const ResourceError& error)
 {
-    WebKitWebSrc* src = ""
+    WebKitWebSrc* src = ""
 
     GST_ERROR_OBJECT(src, "Have failure: %s", error.localizedDescription().utf8().data());
     GST_ELEMENT_ERROR(src, RESOURCE, FAILED, ("%s", error.localizedDescription().utf8().data()), (0));
@@ -1188,7 +1189,7 @@
 
 void ResourceHandleStreamingClient::wasBlocked(ResourceHandle*)
 {
-    WebKitWebSrc* src = ""
+    WebKitWebSrc* src = ""
     GUniquePtr<gchar> uri;
 
     GST_ERROR_OBJECT(src, "Request was blocked");
@@ -1202,7 +1203,7 @@
 
 void ResourceHandleStreamingClient::cannotShowURL(ResourceHandle*)
 {
-    WebKitWebSrc* src = ""
+    WebKitWebSrc* src = ""
     GUniquePtr<gchar> uri;
 
     GST_ERROR_OBJECT(src, "Cannot show URL");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to