qt5_qtwebkit_socketstreamhandle.patch

From: Christian Prochaska <christian.prochaska@genode-labs.com>


---
 .../network/qt/SocketStreamHandlePrivate.h         |    1 +
 .../platform/network/qt/SocketStreamHandleQt.cpp   |   14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
index f447cc2..4e79275 100644
--- a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
+++ b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h
@@ -65,6 +65,7 @@ public Q_SLOTS:
 #endif
 public:
     void initConnections();
+    void init(const KURL& url);
     QTcpSocket* m_socket;
     SocketStreamHandle* m_streamHandle;
 };
diff --git a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
index 271edd8..818fada 100644
--- a/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
+++ b/qtwebkit/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
@@ -57,6 +57,19 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH
         return;
 
     initConnections();
+ }
+
+/*
+ * This code was factored out from the constructor, because its execution can
+ * end up in 'SocketStreamHandle::platformSend()', which needs the
+ * 'SocketStreamHandle::m_p' member, which gets initialized only after the
+ * constructor returned.
+ *
+ * Genode issue #1677
+ */
+void SocketStreamHandlePrivate::init(const KURL& url)
+{
+    bool isSecure = url.protocolIs("wss");
 
     unsigned int port = url.hasPort() ? url.port() : (isSecure ? 443 : 80);
 
@@ -184,6 +197,7 @@ SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient
 {
     LOG(Network, "SocketStreamHandle %p new client %p", this, m_client);
     m_p = new SocketStreamHandlePrivate(this, url);
+    m_p->init(url);
 }
 
 SocketStreamHandle::SocketStreamHandle(QTcpSocket* socket, SocketStreamHandleClient* client)
