qt5: fix use of uninitialized variable

Fixes #1677
This commit is contained in:
Christian Prochaska 2015-09-08 19:04:02 +02:00 committed by Christian Helmuth
parent d5dc25adef
commit 0f8fcab3bd
3 changed files with 56 additions and 1 deletions

View File

@ -1 +1 @@
821f07b61827f72f0efa968453ae521bf19fa6e8 4d7c2192509a580b54ac069e68f1e9ac4d9159bd

View File

@ -0,0 +1,54 @@
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)

View File

@ -11,6 +11,7 @@ qt5_qwidgetwindow.patch
qt5_qtscript.patch qt5_qtscript.patch
qt5_qtnetwork.patch qt5_qtnetwork.patch
qt5_qtwebkit.patch qt5_qtwebkit.patch
qt5_qtwebkit_socketstreamhandle.patch
qt5_textedit_example.patch qt5_textedit_example.patch
qt5_openglwindow_example.patch qt5_openglwindow_example.patch
qt5_qml.patch qt5_qml.patch