diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-11-05 01:52:00 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-11-05 01:53:17 +0100 |
commit | e79ceb97340699ed806aa021e1bda4b63fa6f3fe (patch) | |
tree | 7e9ff3f64e026562eb76b523aa6be615d466598b | |
parent | 825bb10d9bf40587828e4e589b199a9ffec255ce (diff) | |
parent | a21ffd44b3a13a9ef64a56e67f6e267292f0a8e2 (diff) |
Merge remote-tracking branch 'gerrit/5.8' into dev
Change-Id: Ib31cae9b57f6fb078739c409162bf2987eb430ad
-rw-r--r-- | config.tests/qpa/direct2d/direct2d.cpp | 2 | ||||
-rw-r--r-- | configure.pri | 2 | ||||
-rw-r--r-- | mkspecs/features/qt_functions.prf | 62 | ||||
-rw-r--r-- | src/corelib/codecs/QBIG5CODEC_LICENSE.txt | 25 | ||||
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 7 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 35 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 2 | ||||
-rw-r--r-- | src/network/configure.json | 13 | ||||
-rw-r--r-- | src/network/kernel/kernel.pri | 1 | ||||
-rw-r--r-- | src/network/kernel/qnetworkproxy.cpp | 72 | ||||
-rw-r--r-- | src/network/kernel/qnetworkproxy.h | 1 | ||||
-rw-r--r-- | src/network/kernel/qnetworkproxy_p.h | 84 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_winrt.cpp | 22 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_winrt_p.h | 18 | ||||
-rw-r--r-- | src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp | 4 | ||||
-rw-r--r-- | src/platformsupport/fontdatabases/windows/windows.pri | 5 | ||||
-rw-r--r-- | src/plugins/platforms/ios/kernel.pro | 3 | ||||
-rw-r--r-- | src/testlib/3rdparty/qt_attribution.json | 9 |
18 files changed, 208 insertions, 159 deletions
diff --git a/config.tests/qpa/direct2d/direct2d.cpp b/config.tests/qpa/direct2d/direct2d.cpp index b751930bb9..87ce1d1dab 100644 --- a/config.tests/qpa/direct2d/direct2d.cpp +++ b/config.tests/qpa/direct2d/direct2d.cpp @@ -50,6 +50,8 @@ int main(int, char**) { ComPtr<ID2D1Factory1> d2dFactory; D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, d2dFactory.ReleaseAndGetAddressOf()); + ComPtr<IDXGISurface1> surface; + (void)surface; // Q_UNUSED return 0; } diff --git a/configure.pri b/configure.pri index b69dbf3709..cdc13ff87c 100644 --- a/configure.pri +++ b/configure.pri @@ -124,7 +124,7 @@ defineTest(qtConfTest_detectPkgConfig) { !isEmpty(pkgConfig): { qtLog("Found pkg-config from environment variable: $$pkgConfig") } else { - pkgConfig = $$PKG_CONFIG + pkgConfig = $$QMAKE_PKG_CONFIG !isEmpty(pkgConfig) { qtLog("Found pkg-config from mkspec: $$pkgConfig") diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 0f43af10ed..c00fdb73f8 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -237,17 +237,58 @@ defineTest(qtAddTargetEnv) { defineReplace(pkgConfigExecutable) { isEmpty(PKG_CONFIG) { - !isEmpty(QMAKE_PKG_CONFIG): \ + !isEmpty(QMAKE_PKG_CONFIG) { + # Assumed to be properly sysrootified. PKG_CONFIG = $$QMAKE_PKG_CONFIG - else: \ + export(PKG_CONFIG) + } else { PKG_CONFIG = pkg-config + !cross_compile { + export(PKG_CONFIG) + } else { + # Cross compiling, ensure that pkg-config is set up sanely. + sysroot = $$[QT_SYSROOT] + + pkgConfigLibdir = $$(PKG_CONFIG_LIBDIR) + isEmpty(pkgConfigLibdir) { + isEmpty(sysroot) { + warning("Cross compiling without sysroot. Disabling pkg-config.") + return() + } + !exists("$$sysroot/usr/lib/pkgconfig") { + warning("Disabling pkg-config since PKG_CONFIG_LIBDIR is not set and the") + warning("host's .pc files would be used (even if you set PKG_CONFIG_PATH).") + warning("Set this variable to the directory that contains target .pc files") + warning("for pkg-config to function correctly when cross-compiling.") + return() + } + + pkgConfigLibdir = $$system_path($$sysroot/usr/lib/pkgconfig)$$QMAKE_DIRLIST_SEP$$system_path($$sysroot/usr/share/pkgconfig) + !isEmpty(GCC_MACHINE_DUMP): \ + pkgConfigLibdir = "$$pkgConfigLibdir$$QMAKE_DIRLIST_SEP$$system_path($$sysroot/usr/lib/$$GCC_MACHINE_DUMP/pkgconfig)" + message("PKG_CONFIG_LIBDIR automatically set to $$pkgConfigLibdir") + } + pkgConfigSysrootDir = $$(PKG_CONFIG_SYSROOT_DIR) + isEmpty(pkgConfigSysrootDir) { + isEmpty(sysroot) { + warning("Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set.") + warning("Set this variable to your sysroot for pkg-config to function") + warning("correctly when cross-compiling.") + return() + } - sysroot.name = PKG_CONFIG_SYSROOT_DIR - sysroot.value = $$PKG_CONFIG_SYSROOT_DIR - libdir.name = PKG_CONFIG_LIBDIR - libdir.value = $$PKG_CONFIG_LIBDIR - QT_TOOL_NAME = pkg-config - qtAddToolEnv(PKG_CONFIG, sysroot libdir, SYS) + pkgConfigSysrootDir = $$sysroot + message("PKG_CONFIG_SYSROOT_DIR automatically set to $$pkgConfigSysrootDir") + } + + sysroot.name = PKG_CONFIG_SYSROOT_DIR + sysroot.value = $$pkgConfigSysrootDir + libdir.name = PKG_CONFIG_LIBDIR + libdir.value = $$pkgConfigLibdir + QT_TOOL_NAME = pkg-config + qtAddToolEnv(PKG_CONFIG, sysroot libdir, SYS) + } + } } equals(QMAKE_HOST.os, Windows): \ @@ -259,11 +300,6 @@ defineReplace(pkgConfigExecutable) { } defineTest(packagesExist) { - !qtConfig(pkg-config) { - warning("pkg-config disabled, can't check package existence") - return(false) - } - # this can't be done in global scope here because qt_functions is loaded # before the .pro is parsed, so if the .pro set PKG_CONFIG, we wouldn't know it # yet. oops. diff --git a/src/corelib/codecs/QBIG5CODEC_LICENSE.txt b/src/corelib/codecs/QBIG5CODEC_LICENSE.txt new file mode 100644 index 0000000000..e9206a0031 --- /dev/null +++ b/src/corelib/codecs/QBIG5CODEC_LICENSE.txt @@ -0,0 +1,25 @@ +Copyright (C) 2000 Ming-Che Chuang +Copyright (C) 2001, 2002 James Su, Turbolinux Inc. +Copyright (C) 2002 WU Yi, HancomLinux Inc. +Copyright (C) 2001, 2002 Anthony Fok, ThizLinux Laboratory Ltd. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index dcdddeb04d..0b2345f8d4 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1060,13 +1060,6 @@ # undef Q_COMPILER_VARIADIC_TEMPLATES # endif # endif -# if defined(_LIBCPP_VERSION) -// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler -// doesn't support it. That's required for the Intel compiler 14.x or earlier on OS X, for example. -# if !__has_feature(cxx_atomic) -# undef Q_COMPILER_ATOMICS -# endif -# endif # if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC) // Apple's low-level implementation of the C++ support library // (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 3161c41063..987e5379a8 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -2625,21 +2625,28 @@ QString& QString::replace(QChar ch, const QString &after, Qt::CaseSensitivity cs */ QString& QString::replace(QChar before, QChar after, Qt::CaseSensitivity cs) { - ushort a = after.unicode(); - ushort b = before.unicode(); if (d->size) { - detach(); - ushort *i = d->data(); - const ushort *e = i + d->size; - if (cs == Qt::CaseSensitive) { - for (; i != e; ++i) - if (*i == b) - *i = a; - } else { - b = foldCase(b); - for (; i != e; ++i) - if (foldCase(*i) == b) - *i = a; + const int idx = indexOf(before, 0, cs); + if (idx != -1) { + detach(); + const ushort a = after.unicode(); + ushort *i = d->data(); + const ushort *e = i + d->size; + i += idx; + *i = a; + if (cs == Qt::CaseSensitive) { + const ushort b = before.unicode(); + while (++i != e) { + if (*i == b) + *i = a; + } + } else { + const ushort b = foldCase(before.unicode()); + while (++i != e) { + if (foldCase(*i) == b) + *i = a; + } + } } } return *this; diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 1f2528dd5c..2b4c3e7bcd 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -720,7 +720,7 @@ bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFl // deferredFlushWindowSystemEvents from the Gui thread. QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex); QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent(flags); - QWindowSystemInterfacePrivate::handleWindowSystemEvent<SynchronousDelivery>(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent<AsynchronousDelivery>(e); QWindowSystemInterfacePrivate::eventsFlushed.wait(&QWindowSystemInterfacePrivate::flushEventMutex); } else { sendWindowSystemEvents(flags); diff --git a/src/network/configure.json b/src/network/configure.json index 124fa1718f..30a1c39c0c 100644 --- a/src/network/configure.json +++ b/src/network/configure.json @@ -253,6 +253,19 @@ library names through OPENSSL_LIBS. For example: OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked" + }, + { + "type": "warning", + "condition": "features.libproxy && input.qt_namespace == ''", + "message": "Some of libproxy's plugins may use incompatible Qt versions. + + Some platforms and distributions ship libproxy with plugins, such + as config_kde4.so, that are linked against old versions of Qt; and + libproxy loads these plugins automatically when initialized. If Qt + is not in a namespace, that loading causes a crash. Even if the + systems on which you build and test have no such plugins, your + users' systems may have them. We therefore recommend that you + combine -libproxy with -qtnamespace when configuring Qt." } ], diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 7ef387beb4..a80b2d387e 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -18,7 +18,6 @@ HEADERS += kernel/qtnetworkglobal.h \ kernel/qnetworkinterface.h \ kernel/qnetworkinterface_p.h \ kernel/qnetworkproxy.h \ - kernel/qnetworkproxy_p.h \ kernel/qurlinfo_p.h SOURCES += kernel/qauthenticator.cpp \ diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index bb1a7d0d8b..94719e9c2d 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -224,7 +224,6 @@ #ifndef QT_NO_NETWORKPROXY -#include "private/qnetworkproxy_p.h" #include "private/qnetworkrequest_p.h" #include "private/qsocks5socketengine_p.h" #include "private/qhttpsocketengine_p.h" @@ -256,10 +255,12 @@ public: #ifndef QT_NO_HTTP , httpSocketEngineHandler(0) #endif - { #ifdef QT_USE_SYSTEM_PROXIES - setApplicationProxyFactory(new QSystemConfigurationProxyFactory); + , useSystemProxies(true) +#else + , useSystemProxies(false) #endif + { #ifndef QT_NO_SOCKS5 socks5SocketEngineHandler = new QSocks5SocketEngineHandler(); #endif @@ -280,6 +281,24 @@ public: #endif } + bool usesSystemConfiguration() const + { + return useSystemProxies; + } + + void setUseSystemConfiguration(bool enable) + { + QMutexLocker lock(&mutex); + useSystemProxies = enable; + + if (useSystemProxies) { + if (applicationLevelProxy) + *applicationLevelProxy = QNetworkProxy(); + delete applicationLevelProxyFactory; + applicationLevelProxyFactory = nullptr; + } + } + void setApplicationProxy(const QNetworkProxy &proxy) { QMutexLocker lock(&mutex); @@ -288,6 +307,7 @@ public: *applicationLevelProxy = proxy; delete applicationLevelProxyFactory; applicationLevelProxyFactory = 0; + useSystemProxies = false; } void setApplicationProxyFactory(QNetworkProxyFactory *factory) @@ -299,6 +319,7 @@ public: *applicationLevelProxy = QNetworkProxy(); delete applicationLevelProxyFactory; applicationLevelProxyFactory = factory; + useSystemProxies = false; } QNetworkProxy applicationProxy() @@ -318,6 +339,7 @@ private: #ifndef QT_NO_HTTP QHttpSocketEngineHandler *httpSocketEngineHandler; #endif + bool useSystemProxies; }; QList<QNetworkProxy> QGlobalNetworkProxy::proxyForQuery(const QNetworkProxyQuery &query) @@ -339,10 +361,19 @@ QList<QNetworkProxy> QGlobalNetworkProxy::proxyForQuery(const QNetworkProxyQuery if (!applicationLevelProxyFactory) { if (applicationLevelProxy - && applicationLevelProxy->type() != QNetworkProxy::DefaultProxy) + && applicationLevelProxy->type() != QNetworkProxy::DefaultProxy) { result << *applicationLevelProxy; - else + } else if (useSystemProxies) { + result = QNetworkProxyFactory::systemProxyForQuery(query); + + // Make sure NoProxy is in the list, so that QTcpServer can work: + // it searches for the first proxy that can has the ListeningCapability capability + // if none have (as is the case with HTTP proxies), it fails to bind. + // NoProxy allows it to fallback to the 'no proxy' case and bind. + result << QNetworkProxy(QNetworkProxy::NoProxy); + } else { result << QNetworkProxy(QNetworkProxy::NoProxy); + } return result; } @@ -717,7 +748,8 @@ quint16 QNetworkProxy::port() const Setting a default proxy value with this function will override the application proxy factory set with - QNetworkProxyFactory::setApplicationProxyFactory. + QNetworkProxyFactory::setApplicationProxyFactory, and disable the + use of a system proxy. \sa QNetworkProxyFactory, applicationProxy(), QAbstractSocket::setProxy(), QTcpServer::setProxy() */ @@ -1465,6 +1497,17 @@ QNetworkProxyFactory::~QNetworkProxyFactory() { } +/*! + \since 5.8 + + Returns whether the use of platform-specific proxy settings are enabled. +*/ +bool QNetworkProxyFactory::usesSystemConfiguration() +{ + if (globalNetworkProxy()) + return globalNetworkProxy()->usesSystemConfiguration(); + return false; +} /*! \since 4.6 @@ -1472,23 +1515,16 @@ QNetworkProxyFactory::~QNetworkProxyFactory() Enables the use of the platform-specific proxy settings, and only those. See systemProxyForQuery() for more information. - Internally, this method (when called with \a enable set to true) - sets an application-wide proxy factory. For this reason, this method - is mutually exclusive with setApplicationProxyFactory(): calling - setApplicationProxyFactory() overrides the use of the system-wide proxy, - and calling setUseSystemConfiguration() overrides any - application proxy or proxy factory that was previously set. + Calling setUseSystemConfiguration(\c{true}) will reset any proxy or + QNetworkProxyFactory already set. \note See the systemProxyForQuery() documentation for a list of limitations related to the use of system proxies. */ void QNetworkProxyFactory::setUseSystemConfiguration(bool enable) { - if (enable) { - setApplicationProxyFactory(new QSystemConfigurationProxyFactory); - } else { - setApplicationProxyFactory(0); - } + if (globalNetworkProxy()) + globalNetworkProxy()->setUseSystemConfiguration(enable); } /*! @@ -1504,7 +1540,7 @@ void QNetworkProxyFactory::setUseSystemConfiguration(bool enable) If you set a proxy factory with this function, any application level proxies set with QNetworkProxy::setApplicationProxy will be - overridden. + overridden, and usesSystemConfiguration() will return \c{false}. \sa QNetworkProxy::setApplicationProxy(), QAbstractSocket::proxy(), QAbstractSocket::setProxy() diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h index fc919a24a6..8fcb7e33cf 100644 --- a/src/network/kernel/qnetworkproxy.h +++ b/src/network/kernel/qnetworkproxy.h @@ -213,6 +213,7 @@ public: virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0; + static bool usesSystemConfiguration(); static void setUseSystemConfiguration(bool enable); static void setApplicationProxyFactory(QNetworkProxyFactory *factory); static QList<QNetworkProxy> proxyForQuery(const QNetworkProxyQuery &query); diff --git a/src/network/kernel/qnetworkproxy_p.h b/src/network/kernel/qnetworkproxy_p.h deleted file mode 100644 index 733d8436d0..0000000000 --- a/src/network/kernel/qnetworkproxy_p.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 David Faure <dfaure@kdab.net> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKPROXY_P_H -#define QNETWORKPROXY_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtNetwork/private/qtnetworkglobal_p.h> - -#ifndef QT_NO_NETWORKPROXY - -QT_BEGIN_NAMESPACE - -class QSystemConfigurationProxyFactory : public QNetworkProxyFactory -{ -public: - QSystemConfigurationProxyFactory() : QNetworkProxyFactory() {} - - virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery& query) - { - QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(query); - - // Make sure NoProxy is in the list, so that QTcpServer can work: - // it searches for the first proxy that can has the ListeningCapability capability - // if none have (as is the case with HTTP proxies), it fails to bind. - // NoProxy allows it to fallback to the 'no proxy' case and bind. - proxies.append(QNetworkProxy::NoProxy); - - return proxies; - } -}; - -QT_END_NAMESPACE - -#endif // QT_NO_NETWORKINTERFACE - -#endif - diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index f8e92d3f50..62bc8ca683 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -329,6 +329,7 @@ bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket:: hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, readOp.GetAddressOf()); RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).", socketDescription(this).constData()); + QMutexLocker locker(&d->readOperationsMutex); d->pendingReadOps.append(readOp); d->socketState = socketState; hr = readOp->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); @@ -574,6 +575,7 @@ void QNativeSocketEngine::close() } #endif // _MSC_VER >= 1900 + QMutexLocker locker(&d->readOperationsMutex); for (ComPtr<IAsyncBufferOperation> readOp : d->pendingReadOps) { ComPtr<IAsyncInfo> info; hr = readOp.As(&info); @@ -585,6 +587,7 @@ void QNativeSocketEngine::close() Q_ASSERT_SUCCEEDED(hr); } } + locker.unlock(); if (d->socketDescriptor != -1) { ComPtr<IClosable> socket; @@ -659,6 +662,7 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxlen) if (d->socketType != QAbstractSocket::TcpSocket) return -1; + QMutexLocker mutexLocker(&d->readMutex); // There will be a read notification when the socket was closed by the remote host. If that // happens and there isn't anything left in the buffer, we have to return -1 in order to signal // the closing of the socket. @@ -667,7 +671,6 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxlen) return -1; } - QMutexLocker mutexLocker(&d->readMutex); qint64 b = d->readBytes.read(data, maxlen); d->bytesAvailable = d->readBytes.size() - d->readBytes.pos(); return b; @@ -701,7 +704,7 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea { #ifndef QT_NO_UDPSOCKET Q_D(QNativeSocketEngine); - d->readMutex.lock(); + QMutexLocker locker(&d->readMutex); if (d->socketType != QAbstractSocket::UdpSocket || d->pendingDatagrams.isEmpty()) { if (header) header->clear(); @@ -721,7 +724,7 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea } else { readOrigin = datagram.data; } - d->readMutex.unlock(); + locker.unlock(); memcpy(data, readOrigin, qMin(maxlen, qint64(datagram.data.length()))); return readOrigin.length(); #else @@ -772,12 +775,14 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QI bool QNativeSocketEngine::hasPendingDatagrams() const { Q_D(const QNativeSocketEngine); + QMutexLocker locker(&d->readMutex); return d->pendingDatagrams.length() > 0; } qint64 QNativeSocketEngine::pendingDatagramSize() const { Q_D(const QNativeSocketEngine); + QMutexLocker locker(&d->readMutex); if (d->pendingDatagrams.isEmpty()) return -1; @@ -943,6 +948,7 @@ void QNativeSocketEngine::establishRead() ComPtr<IAsyncBufferOperation> readOp; hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, readOp.GetAddressOf()); RETURN_HR_IF_FAILED("establishRead(): Failed to initiate socket read"); + QMutexLocker locker(&d->readOperationsMutex); d->pendingReadOps.append(readOp); hr = readOp->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); RETURN_HR_IF_FAILED("establishRead(): Failed to register read callback"); @@ -1419,15 +1425,15 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async } Q_Q(QNativeSocketEngine); + QMutexLocker locker(&readOperationsMutex); for (int i = 0; i < pendingReadOps.count(); ++i) { if (pendingReadOps.at(i).Get() == asyncInfo) { pendingReadOps.takeAt(i); break; } } + locker.unlock(); - static QMutex mutex; - mutex.lock(); // A read in UnconnectedState will close the socket and return -1 and thus tell the caller, // that the connection was closed. The socket cannot be closed here, as the subsequent read // might fail then. @@ -1465,7 +1471,7 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async hr = byteArrayAccess->Buffer(&data); Q_ASSERT_SUCCEEDED(hr); - readMutex.lock(); + QMutexLocker readLocker(&readMutex); if (readBytes.atEnd()) // Everything has been read; the buffer is safe to reset readBytes.close(); if (!readBytes.isOpen()) @@ -1476,11 +1482,10 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async readBytes.write(reinterpret_cast<const char*>(data), qint64(bufferLength)); readBytes.seek(readPos); bytesAvailable = readBytes.size() - readBytes.pos(); - readMutex.unlock(); + readLocker.unlock(); if (notifyOnRead) emit q->readReady(); - mutex.unlock(); hr = QEventDispatcherWinRT::runOnXamlThread([buffer, q, this]() { UINT32 readBufferLength; @@ -1501,6 +1506,7 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async socketDescription(q).constData()); return S_OK; } + QMutexLocker locker(&readOperationsMutex); pendingReadOps.append(readOp); hr = readOp->put_Completed(Callback<SocketReadCompletedHandler>(this, &QNativeSocketEnginePrivate::handleReadyRead).Get()); if (FAILED(hr)) { diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h index 79530d57f1..085704275c 100644 --- a/src/network/socket/qnativesocketengine_winrt_p.h +++ b/src/network/socket/qnativesocketengine_winrt_p.h @@ -214,13 +214,27 @@ private: { return reinterpret_cast<ABI::Windows::Networking::Sockets::IDatagramSocket *>(socketDescriptor); } Microsoft::WRL::ComPtr<ABI::Windows::Networking::Sockets::IStreamSocketListener> tcpListener; Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncAction> connectOp; + + // Protected by readOperationsMutex. Written in handleReadyRead (native callback) QVector<Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncOperationWithProgress<ABI::Windows::Storage::Streams::IBuffer *, UINT32>>> pendingReadOps; + + // Protected by readMutex. Written in handleReadyRead (native callback) QBuffer readBytes; - QMutex readMutex; - bool emitOnNewDatagram; + + // In case of TCP readMutex protects readBytes and bytesAvailable. In case of UDP it is + // pendingDatagrams. They are written inside native callbacks (handleReadyRead and + // handleNewDatagrams/putIntoPendingDatagramsList) + mutable QMutex readMutex; + + // As pendingReadOps is changed inside handleReadyRead(native callback) it has to be protected + QMutex readOperationsMutex; + + // Protected by readMutex. Written in handleReadyRead (native callback) QAtomicInteger<int> bytesAvailable; + // Protected by readMutex. Written in handleNewDatagrams/putIntoPendingDatagramsList QList<WinRtDatagram> pendingDatagrams; + QList<ABI::Windows::Networking::Sockets::IStreamSocket *> pendingConnections; QList<ABI::Windows::Networking::Sockets::IStreamSocket *> currentConnections; QEventLoop eventLoop; diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp index f266e85126..6130107cc8 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp @@ -49,6 +49,7 @@ #include <QtCore/private/qsystemlibrary_p.h> #include <QtGui/private/qguiapplication_p.h> #include <qpa/qplatformintegration.h> +#include <QtGui/private/qhighdpiscaling_p.h> #if defined(QT_USE_DIRECTWRITE2) # include <dwrite_2.h> @@ -185,6 +186,9 @@ namespace { static DWRITE_RENDERING_MODE hintingPreferenceToRenderingMode(QFont::HintingPreference hintingPreference) { + if (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting) + hintingPreference = QFont::PreferVerticalHinting; + switch (hintingPreference) { case QFont::PreferNoHinting: return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC; diff --git a/src/platformsupport/fontdatabases/windows/windows.pri b/src/platformsupport/fontdatabases/windows/windows.pri index 419c4dc6d9..4fc4e7b8ec 100644 --- a/src/platformsupport/fontdatabases/windows/windows.pri +++ b/src/platformsupport/fontdatabases/windows/windows.pri @@ -13,11 +13,6 @@ HEADERS += \ qtConfig(freetype) { SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp HEADERS += $$PWD/qwindowsfontdatabase_ft_p.h - qtConfig(system-freetype) { - include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri) - } else { - include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) - } } qtConfig(directwrite) { diff --git a/src/plugins/platforms/ios/kernel.pro b/src/plugins/platforms/ios/kernel.pro index 0fe012071d..71257d09f7 100644 --- a/src/plugins/platforms/ios/kernel.pro +++ b/src/plugins/platforms/ios/kernel.pro @@ -48,8 +48,7 @@ HEADERS = \ quiview.h \ quiaccessibilityelement.h \ qiosplatformaccessibility.h \ - qiostextresponder.h \ - qiosfileenginefactory.h + qiostextresponder.h !tvos { LIBS += -framework AssetsLibrary diff --git a/src/testlib/3rdparty/qt_attribution.json b/src/testlib/3rdparty/qt_attribution.json index 23d230cb5c..d8b0ad1fc7 100644 --- a/src/testlib/3rdparty/qt_attribution.json +++ b/src/testlib/3rdparty/qt_attribution.json @@ -4,8 +4,9 @@ "Name": "Callgrind", "QDocModule": "qttestlib", "QtUsage": "Used on Linux ond MacOS in the Qt Test module.", + "Files": "valgrind_p.h callgrind_p.h", - "Description": "callgrind_p.h is part of Valgrind: an instrumentation framework for building dynamic analysis tools.", + "Description": "Part of Valgrind: an instrumentation framework for building dynamic analysis tools.", "Homepage": "http://valgrind.org/", "License": "BSD 4-clause \"Original\" or \"Old\" License", "LicenseId": "BSD-4-Clause", @@ -17,8 +18,9 @@ "Name": "Cycle", "QDocModule": "qttestlib", "QtUsage": "Used in the Qt Test module.", + "Files": "cycle_p.h", - "Description": "cycle_p.h allows to access the CPU's cycle counters.", + "Description": "Allows to access the CPU's cycle counters.", "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "CYCLE_LICENSE.txt", @@ -30,8 +32,9 @@ Copyright (c) 2003, 2006 Massachusetts Institute of Technology" "Name": "Linux Performance Events", "QDocModule": "qttestlib", "QtUsage": "Used on Linux and Android in the Qt Test module.", + "Files": "linux_perf_event_p.h", - "Description": "linux_perf_event_p.h allows access to the LInux kernel's performance events.", + "Description": "Allows access to the Linux kernel's performance events.", "License": "GNU General Public License v2.0 only", "LicenseId": "GPL-2.0", "LicenseFile": "LINUX_LICENSE.txt", |