From e8c806793ad77ab8abe2bda855628257ec04b8b5 Mon Sep 17 00:00:00 2001 From: Xizhi Zhu Date: Thu, 15 Mar 2012 11:00:14 +0100 Subject: Make sure QGlobalNetworkProxy is created for QNetworkProxy. Otherwise, you don't have any socket engine handler created when directly setting a proxy to a socket. Cherry-picked from Qt5 / QtBase commit: 92659bacda53da782c84dff44d3caa2590dbc7cc Change-Id: Id87a13cf496553e85ca1f92f0cb5093752f3f5f5 Reviewed-by: Shane Kearns --- src/network/kernel/qnetworkproxy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 4f294b9..7386093 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -423,6 +423,10 @@ template<> void QSharedDataPointer::detach() QNetworkProxy::QNetworkProxy() : d(0) { + // make sure we have QGlobalNetworkProxy singleton created, otherwise + // you don't have any socket engine handler created when directly setting + // a proxy to the socket + globalNetworkProxy(); } /*! @@ -437,6 +441,10 @@ QNetworkProxy::QNetworkProxy(ProxyType type, const QString &hostName, quint16 po const QString &user, const QString &password) : d(new QNetworkProxyPrivate(type, hostName, port, user, password)) { + // make sure we have QGlobalNetworkProxy singleton created, otherwise + // you don't have any socket engine handler created when directly setting + // a proxy to a socket + globalNetworkProxy(); } /*! -- cgit v0.12