From 28ba681eb6f53ec817b191f3d8ff62ffe282bac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 20 Aug 2019 14:41:47 +0200 Subject: [PATCH 01/15] macOS: Whitelist the 10.15 SDK for building Qt and applications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I63689e79d08429e7760bb85a1f2b3f5825178428 Reviewed-by: Jörg Bornemann Reviewed-by: Timur Pocheptsov --- mkspecs/common/macx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf index 889027ada5..67552dcc6c 100644 --- a/mkspecs/common/macx.conf +++ b/mkspecs/common/macx.conf @@ -8,7 +8,7 @@ QMAKE_MAC_SDK = macosx QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12 QMAKE_APPLE_DEVICE_ARCHS = x86_64 QT_MAC_SDK_VERSION_MIN = 10.13 -QT_MAC_SDK_VERSION_MAX = 10.14 +QT_MAC_SDK_VERSION_MAX = 10.15 device.sdk = macosx device.target = device From fc6d569862e524cf46c322eb0cdcdd6ac641dcef Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 13 Aug 2019 13:41:38 +0200 Subject: [PATCH 02/15] Do not prepend QMAKE_PREFIX_STATICLIB to TARGET for TEMPLATE aux This was introduced by accident in 4da47d0f. Fixes: QTBUG-77429 Change-Id: Ic3d9052e1fc83dab5ed3b8725629588208b0d7bb Reviewed-by: Oliver Wolff (cherry picked from commit 2a4cf923f4022760f9ed0f5dc50f8b849433b3f9) Reviewed-by: Kai Koehne --- qmake/generators/unix/unixmake2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index abc37149a9..84f55ca689 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1202,8 +1202,10 @@ void UnixMakefileGenerator::init2() project->values("QMAKE_FRAMEWORK_VERSION").append(project->first("VER_MAJ")); if (project->first("TEMPLATE") == "aux") { - project->values("PRL_TARGET") = - project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB")); + project->values("PRL_TARGET") = { + project->first("QMAKE_PREFIX_STATICLIB") + + project->first("TARGET") + }; } else if (!project->values("QMAKE_APP_FLAG").isEmpty()) { if(!project->isEmpty("QMAKE_BUNDLE")) { ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION"); From b2df41b5a8649ea3f7c9cc2e23f6c5a06a1e4ea7 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Tue, 20 Aug 2019 13:16:25 +0300 Subject: [PATCH 03/15] Add changes file for Qt 5.12.5 Change-Id: Ic3c3c0d934b2f6b8980c165c4a464442fc4cebbc Reviewed-by: Eirik Aavitsland Reviewed-by: Edward Welbourne --- dist/changes-5.12.5 | 109 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 dist/changes-5.12.5 diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5 new file mode 100644 index 0000000000..c22839db78 --- /dev/null +++ b/dist/changes-5.12.5 @@ -0,0 +1,109 @@ +Qt 5.12.5 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0 through 5.12.4. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* QtCore * +**************************************************************************** + + - QBitArray: + * Fixed two bugs that caused QBitArrays created using fromBits() not to + compare equal to the equivalent QBitArray created using other methods + if the size was zero or not a multiple of 4. If the size modulus 8 was + 5, 6, or 7, the data was actually incorrect. + + - QCborStreamReader: + * Fixed a bug that caused the QIODevice that the data was being read + from not to show the entire CBOR message as consumed. This allows the + user to consume data that may follow the CBOR payload. + + - QCryptographicHash: + * Fixed a bug that caused the SHA-3 and Keccak algorithms to crash if + passed 256 MB of data or more. + + - QObject: + * Fixed a resource leak caused by a race condition if multiple QObjects + were created at the same time, for the first time in an application, + from multiple threads (implies threads not started with QThread). + + - QStorageInfo: + * Fixed a bug that caused QStorageInfo to be unable to report all + filesystems if the options to mounted filesystems were too long (over + 900 characters, roughly), such as those found in Docker overlay + mounts. + + - QTimeZone: + * The IANA timezone database backend now properly follows symlinks even + when they point to variable locations like /run or /var (useful when + /etc is mounted read-only). + +**************************************************************************** +* QtGui * +**************************************************************************** + + - QImage: + * Improve loading time when loading png files that have the same size as + the target. + + - QPixmapCache: + * [QTBUG-76694][QTBUG-72523] Ignore unsafe access from non-main threads + + - Text: + * [QTBUG-76219] Fixed a bug which could cause the font cache to grow + larger than it was supposed to. + * [QTBUG-55096][QTBUG-74761] Fixed bug where regular text rendered with + a color font would always display in black. + * [QTBUG-69546] Fixed a crash bug in + QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack). + +**************************************************************************** +* QtNetwork * +**************************************************************************** + + - QHostInfo: + * Functors used in the lookupHost overloads are now called correctly in + the thread of the context object. When used without context object, + the thread that initiates the lookup will run the functor, and is + required to run an event loop. + + - Windows: + * Correctly emit errors when trying to reach unreachable hosts or + services + +**************************************************************************** +* QtWidgets * +**************************************************************************** + + - QGraphicsView: + * Ignore disabled items when setting the mouse cursor. + + - QSplashScreen: + * On macOS, lower the splash screen when a modal dialog is shown to make + sure the user sees the dialog. + + - QSystemTrayIcon: + * On macOS, show the icon passed into showMessage in the notification + popup + +**************************************************************************** +* Android * +**************************************************************************** + + - [QTBUG-76293] Fix NDK r20 linking. + - [QTBUG-76036] Fixed an issue where menus would not work on 64 bit + builds. From 1232205e32464d90e871f39eb1e14fcf9b78a163 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Tue, 27 Aug 2019 14:44:48 +0200 Subject: [PATCH 04/15] Fix crash when text contains too many directional chars In case a text to be layouted contains more than 128 directional characters it causes the application to crash The function initScriptAnalysisAndIsolatePairs() collects information of RTL/LTR chaaracters into vector "isolatePairs". The size of the vector is capped to 128. Later the function generateDirectionalRuns() iterates the text again and tries to access items from the previously capped vector above the upper bound. Task-number: QTBUG-77819 Change-Id: Ibb7bf12c12b1db22f43ff46236518da3fdeed26a Reviewed-by: Simon Hausmann --- src/gui/text/qtextengine.cpp | 15 +++++++-------- .../gui/text/qtextlayout/tst_qtextlayout.cpp | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 2da13289bf..a7834587b1 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -399,6 +399,7 @@ struct QBidiAlgorithm { analysis[i].bidiDirection = (level & 1) ? QChar::DirR : QChar::DirL; runHasContent = true; lastRunWithContent = -1; + ++isolatePairPosition; } int runBeforeIsolate = runs.size(); ushort newLevel = isRtl ? ((stack.top().level + 1) | 1) : ((stack.top().level + 2) & ~1); @@ -440,21 +441,19 @@ struct QBidiAlgorithm { doEmbed(true, true, false); break; case QChar::DirLRI: - Q_ASSERT(isolatePairs.at(isolatePairPosition).start == i); doEmbed(false, false, true); - ++isolatePairPosition; break; case QChar::DirRLI: - Q_ASSERT(isolatePairs.at(isolatePairPosition).start == i); doEmbed(true, false, true); - ++isolatePairPosition; break; case QChar::DirFSI: { - const auto &pair = isolatePairs.at(isolatePairPosition); - Q_ASSERT(pair.start == i); - bool isRtl = QStringView(text + pair.start + 1, pair.end - pair.start - 1).isRightToLeft(); + bool isRtl = false; + if (isolatePairPosition < isolatePairs.size()) { + const auto &pair = isolatePairs.at(isolatePairPosition); + Q_ASSERT(pair.start == i); + isRtl = QStringView(text + pair.start + 1, pair.end - pair.start - 1).isRightToLeft(); + } doEmbed(isRtl, false, true); - ++isolatePairPosition; break; } diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 9c477589f9..f0a32c2ed4 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -138,6 +138,7 @@ private slots: void noModificationOfInputString(); void superscriptCrash_qtbug53911(); void showLineAndParagraphSeparatorsCrash(); + void tooManyDirectionalCharctersCrash_qtbug77819(); private: QFont testFont; @@ -2309,5 +2310,21 @@ void tst_QTextLayout::nbspWithFormat() QCOMPARE(layout.lineAt(1).textLength(), s2.length() + 1 + s3.length()); } +void tst_QTextLayout::tooManyDirectionalCharctersCrash_qtbug77819() +{ + QString data; + data += QString::fromUtf8("\xe2\x81\xa8"); // U+2068 FSI character + data += QString::fromUtf8("\xe2\x81\xa7"); // U+2067 RLI character + + // duplicating the text + for (int i = 0; i < 10; i++) + data += data; + + // Nothing to test. It must not crash in beginLayout(). + QTextLayout tl(data); + tl.beginLayout(); + tl.endLayout(); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" From 7b82d27429cde931114776f1a26f4c3850c8bb72 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 26 Aug 2019 15:21:03 +0200 Subject: [PATCH 05/15] Fix library suffix replacement for xcode projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In xcode projects we replace the _debug part of referenced libraries with the variable $(QT_LIBRARY_SUFFIX). This only worked for libraries passed with -l. Make the library suffix replacement work for libraries passed as absolute paths too. Fixes: QTBUG-77804 Change-Id: Iac2dbd2f67c3fa0f415ac43cbab5a906657164e5 Reviewed-by: Tor Arne Vestbø --- qmake/generators/mac/pbuilder_pbx.cpp | 110 ++++++++++++++++---------- qmake/generators/mac/pbuilder_pbx.h | 2 + 2 files changed, 69 insertions(+), 43 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index d5994639b3..b7c3031b7b 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -514,6 +514,56 @@ static QList provisioningTeams() return flatTeams; } +bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_file, + const ProString &opt, + QString &name, QString &library) +{ + /* This isn't real nice, but it is real useful. This looks in a prl + for what the library will ultimately be called so we can stick it + in the ProjectFile. If the prl format ever changes (not likely) then + this will not really work. However, more concerning is that it will + encode the version number in the Project file which might be a bad + things in days to come? --Sam + */ + if (lib_file.isEmpty()) + return false; + + QMakeMetaInfo libinfo; + if (!libinfo.readLib(lib_file) || libinfo.isEmpty("QMAKE_PRL_TARGET")) + return false; + + const QString libDir = fileInfo(lib_file).absolutePath(); + library = libDir + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET"); + + debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", + opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData()); + + if (project->isActiveConfig("xcode_dynamic_library_suffix")) { + QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString(); + if (!suffixSetting.isEmpty()) { + QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString(); + suffixSetting = "$(" + suffixSetting + ")"; + if (!librarySuffix.isEmpty()) { + int pos = library.lastIndexOf(librarySuffix + '.'); + if (pos == -1) { + warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.", + qPrintable(librarySuffix), qPrintable(library)); + } else { + library.replace(pos, librarySuffix.length(), suffixSetting); + if (name.endsWith(librarySuffix)) + name.chop(librarySuffix.length()); + } + } else { + int pos = library.lastIndexOf(name); + if (pos != -1) + library.insert(pos + name.length(), suffixSetting); + } + } + } + + return true; +} + bool ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) { @@ -832,6 +882,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) for (int i = 0; libs[i]; i++) { tmp = project->values(libs[i]); for(int x = 0; x < tmp.count();) { + bool libSuffixReplaced = false; bool remove = false; QString library, name; ProString opt = tmp[x]; @@ -844,49 +895,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QString lib("lib" + name); for (ProStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) { if(project->isActiveConfig("link_prl")) { - /* This isn't real nice, but it is real useful. This looks in a prl - for what the library will ultimately be called so we can stick it - in the ProjectFile. If the prl format ever changes (not likely) then - this will not really work. However, more concerning is that it will - encode the version number in the Project file which might be a bad - things in days to come? --Sam - */ - QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath( - (*lit) + Option::dir_sep + lib + Option::prl_ext)); - if (!lib_file.isEmpty()) { - QMakeMetaInfo libinfo; - if(libinfo.readLib(lib_file)) { - if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) { - library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET"); - debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", - opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData()); - remove = true; - - if (project->isActiveConfig("xcode_dynamic_library_suffix")) { - QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString(); - if (!suffixSetting.isEmpty()) { - QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString(); - suffixSetting = "$(" + suffixSetting + ")"; - if (!librarySuffix.isEmpty()) { - int pos = library.lastIndexOf(librarySuffix + '.'); - if (pos == -1) { - warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.", - qPrintable(librarySuffix), qPrintable(library)); - } else { - library.replace(pos, librarySuffix.length(), suffixSetting); - if (name.endsWith(librarySuffix)) - name.chop(librarySuffix.length()); - } - } else { - int pos = library.lastIndexOf(name); - if (pos != -1) - library.insert(pos + name.length(), suffixSetting); - } - } - } - } - } - } + const QString prlFilePath = QMakeMetaInfo::checkLib( + Option::normalizePath((*lit) + Option::dir_sep + lib + + Option::prl_ext)); + if (replaceLibrarySuffix(prlFilePath, opt, name, library)) + remove = true; + libSuffixReplaced = true; } if(!remove) { QString extns[] = { ".dylib", ".so", ".a", QString() }; @@ -936,6 +950,16 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } } if(!library.isEmpty()) { + if (!libSuffixReplaced) { + const QFileInfo fi = fileInfo(library); + const QString prlFilePath = QMakeMetaInfo::checkLib( + Option::normalizePath(fi.absolutePath() + '/' + fi.completeBaseName() + + Option::prl_ext)); + if (!prlFilePath.isEmpty()) { + name = fi.completeBaseName().mid(3); + replaceLibrarySuffix(prlFilePath, opt, name, library); + } + } const int slsh = library.lastIndexOf(Option::dir_sep); if(name.isEmpty()) { if(slsh != -1) diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h index f15c814cb4..a7b21a0dab 100644 --- a/qmake/generators/mac/pbuilder_pbx.h +++ b/qmake/generators/mac/pbuilder_pbx.h @@ -41,6 +41,8 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator bool writeSubDirs(QTextStream &); bool writeMakeParts(QTextStream &); bool writeMakefile(QTextStream &) override; + bool replaceLibrarySuffix(const QString &lib_file, const ProString &opt, QString &name, + QString &library); QString pbxbuild(); QHash keys; From f6b34ce173830e470ae01597c7c1d66eaee58617 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Aug 2019 12:25:41 +0200 Subject: [PATCH 06/15] Windows QPA: Update theme fonts when the primary screen changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Call into the theme to update the fonts on a change. This at least helps in the case of disabled High DPI scaling. Task-number: QTBUG-77144 Change-Id: I2c8fd85259403eaaeea56cd096f99116fc6bba9a Reviewed-by: André de la Rocha Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowsscreen.cpp | 6 ++++++ src/plugins/platforms/windows/qwindowstheme.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 4137a4bd9a..cecd06f5a4 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -42,6 +42,7 @@ #include "qwindowswindow.h" #include "qwindowsintegration.h" #include "qwindowscursor.h" +#include "qwindowstheme.h" #include @@ -547,10 +548,13 @@ bool QWindowsScreenManager::handleScreenChanges() // Look for changed monitors, add new ones const WindowsScreenDataList newDataList = monitorData(); const bool lockScreen = newDataList.size() == 1 && (newDataList.front().flags & QWindowsScreenData::LockScreen); + bool primaryScreenChanged = false; for (const QWindowsScreenData &newData : newDataList) { const int existingIndex = indexOfMonitor(m_screens, newData.name); if (existingIndex != -1) { m_screens.at(existingIndex)->handleChanges(newData); + if (existingIndex == 0) + primaryScreenChanged = true; } else { QWindowsScreen *newScreen = new QWindowsScreen(newData); m_screens.push_back(newScreen); @@ -567,6 +571,8 @@ bool QWindowsScreenManager::handleScreenChanges() removeScreen(i); } // for existing screens } // not lock screen + if (primaryScreenChanged) + QWindowsTheme::instance()->refreshFonts(); return true; } diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h index c132f20167..28c69e4ec1 100644 --- a/src/plugins/platforms/windows/qwindowstheme.h +++ b/src/plugins/platforms/windows/qwindowstheme.h @@ -85,6 +85,8 @@ public: static bool useNativeMenus(); + void refreshFonts(); + static const char *name; private: @@ -92,7 +94,6 @@ private: void clearPalettes(); void refreshPalettes(); void clearFonts(); - void refreshFonts(); void refreshIconPixmapSizes(); static QWindowsTheme *m_instance; From 6bb51e0f08bb810245e5dd4b00ee3c36d0811a48 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 30 Aug 2019 14:45:42 +0200 Subject: [PATCH 07/15] QPainter lancelot test: improve drawImage testing In QPainter, there is a shortcut code path for the drawImage(point, image) call, relative to the full drawImage(targetRect, img, srcRect). The lance script interpreter would only use the latter, so the former was not covered by the tests. As a driveby, remove the pointless usage of non-default dithering flags in drawImage(), since it is more important to test the default. Change-Id: Id373fd528a0c4c40b6bd8eea37b960fd7cdb2cc7 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/other/lancelot/paintcommands.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 8aa3a035e3..60f95ed2ae 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -1010,7 +1010,10 @@ void PaintCommands::command_drawPixmap(QRegularExpressionMatch re) qPrintable(re.captured(1)), pm.width(), pm.height(), pm.depth(), tx, ty, tw, th, sx, sy, sw, sh); - m_painter->drawPixmap(QRectF(tx, ty, tw, th), pm, QRectF(sx, sy, sw, sh)); + if (!re.capturedLength(4)) // at most two coordinates specified + m_painter->drawPixmap(QPointF(tx, ty), pm); + else + m_painter->drawPixmap(QRectF(tx, ty, tw, th), pm, QRectF(sx, sy, sw, sh)); } /***************************************************************************************************/ @@ -1057,7 +1060,10 @@ void PaintCommands::command_drawImage(QRegularExpressionMatch re) printf(" -(lance) drawImage('%s' dim=(%d, %d), (%f, %f, %f, %f), (%f, %f, %f, %f)\n", qPrintable(re.captured(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh); - m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh), Qt::OrderedDither | Qt::OrderedAlphaDither); + if (!re.capturedLength(4)) // at most two coordinates specified + m_painter->drawImage(QPointF(tx, ty), im); + else + m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh)); } /***************************************************************************************************/ From dbfa374a8610948f6e03ea1b3f3bc2905ce05be0 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 2 Sep 2019 10:43:29 +0200 Subject: [PATCH 08/15] QHttpNetworkConnectionChannel - avoid re-connecting on 'disconnected' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The _q_error slot has a special case for RemoteHostClosedError, where the current channel's state is 'idle' and no request/reply is in progress. The comment states that: "Not actually an error, it is normal for Keep-Alive connections to close after some time if no request is sent on them. No need to error the other replies below. Just bail out here. The _q_disconnected will handle the possibly pipelined replies." _q_disconnected, indeed, takes care about pipelined replies ... calling 'ensureConnected' even if we have 0 replies in pipeline, which makes zero sense to me and results in QNAM endlessly trying to re-connect to the server. Fixes: QTBUG-77852 Change-Id: I6dcb43b36a6d432bc940246a08f65e1ee903fd24 Reviewed-by: Volker Hilsheimer Reviewed-by: Mårten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/access/qhttpnetworkconnectionchannel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 38adca2633..e7af7b648e 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -849,8 +849,11 @@ void QHttpNetworkConnectionChannel::_q_disconnected() QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } state = QHttpNetworkConnectionChannel::IdleState; - - requeueCurrentlyPipelinedRequests(); + if (alreadyPipelinedRequests.length()) { + // If nothing was in a pipeline, no need in calling + // _q_startNextRequest (which it does): + requeueCurrentlyPipelinedRequests(); + } pendingEncrypt = false; } From 98c5f22161e25c0f6867c0bf7db7aa8d6fcf6074 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 30 Aug 2019 19:51:19 +0300 Subject: [PATCH 09/15] Avoid invalid memory access in QIconCacheGtkReader::lookup() If name argument is empty, e.g. an icon is created by QIcon::fromTheme(""), then icon_name_hash() will access a byte at index 1, which is outside of the string. Change-Id: I109c476718939d7dd252007ebac48c3dbbeceb72 Reviewed-by: Eirik Aavitsland --- src/gui/image/qiconloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 1d0c93f26f..27c82bc09f 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -281,7 +281,7 @@ static quint32 icon_name_hash(const char *p) QVector QIconCacheGtkReader::lookup(const QStringRef &name) { QVector ret; - if (!isValid()) + if (!isValid() || name.isEmpty()) return ret; QByteArray nameUtf8 = name.toUtf8(); From 1b0c45f683cef20aacc8f40273aa89200e9924e4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 23 Aug 2019 08:47:30 +0200 Subject: [PATCH 10/15] Deliver stationary touchpoints that have changed pressure As a rule, we don't deliver touch events containing only stationary touchpoints. To fix QTBUG-52510 we added an exception in 1bd0ab7050304d9e8989cde77e486947c56b9696 : if the velocity changed, deliver it anyway. Now we need to do the same if the pressure changed. Also, on the customer's hardware, pressure is indicated via ABS_MT_PRESSURE. Change-Id: If7f7088df055d686cdd86967b999e38024f8170f Fixes: QTBUG-77142 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qguiapplication.cpp | 10 +++++++--- .../input/evdevtouch/qevdevtouchhandler.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 359d182dd9..51cde72fa1 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2695,7 +2695,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To QWindow *window = e->window.data(); typedef QPair > StatesAndTouchPoints; QHash windowsNeedingEvents; - bool stationaryTouchPointChangedVelocity = false; + bool stationaryTouchPointChangedProperty = false; for (int i = 0; i < e->points.count(); ++i) { QTouchEvent::TouchPoint touchPoint = e->points.at(i); @@ -2775,7 +2775,11 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To if (touchPoint.state() == Qt::TouchPointStationary) { if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) { touchInfo.touchPoint.setVelocity(touchPoint.velocity()); - stationaryTouchPointChangedVelocity = true; + stationaryTouchPointChangedProperty = true; + } + if (!qFuzzyCompare(touchInfo.touchPoint.pressure(), touchPoint.pressure())) { + touchInfo.touchPoint.setPressure(touchPoint.pressure()); + stationaryTouchPointChangedProperty = true; } } else { touchInfo.touchPoint = touchPoint; @@ -2816,7 +2820,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To break; case Qt::TouchPointStationary: // don't send the event if nothing changed - if (!stationaryTouchPointChangedVelocity) + if (!stationaryTouchPointChangedProperty) continue; Q_FALLTHROUGH(); default: diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index f3cc160b3e..b5bd2dcff4 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -532,7 +532,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) m_currentData.state = Qt::TouchPointReleased; if (m_typeB) m_contacts[m_currentSlot].maj = m_currentData.maj; - } else if (data->code == ABS_PRESSURE) { + } else if (data->code == ABS_PRESSURE || data->code == ABS_MT_PRESSURE) { m_currentData.pressure = qBound(hw_pressure_min, data->value, hw_pressure_max); if (m_typeB || m_singleTouch) m_contacts[m_currentSlot].pressure = m_currentData.pressure; From abfb1b8665923ce2824392f3a04e5e4ac3871017 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 26 Aug 2019 13:48:03 +0200 Subject: [PATCH 11/15] Don't add default lib dirs to LIBRARY_SEARCH_PATHS in xcode projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having hard-coded absolute paths in the xcode project breaks switching between iOS and simulator builds. Fixes: QTBUG-77804 Change-Id: Ib655bfc774b92c413a7b94ba4d005b6e1c4d2905 (cherry picked from commit 97465b1540ebd095225679b5dd400b2d4d54e678) Reviewed-by: Tor Arne Vestbø --- qmake/generators/mac/pbuilder_pbx.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index b7c3031b7b..8f3eb738b4 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -875,6 +875,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES + const ProStringList defaultLibDirs = project->values("QMAKE_DEFAULT_LIBDIRS"); ProStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"), &frameworkdirs = project->values("QMAKE_FRAMEWORKPATH"); static const char * const libs[] = { "LIBS", "LIBS_PRIVATE", @@ -967,8 +968,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } if(slsh != -1) { const QString path = QFileInfo(library.left(slsh)).absoluteFilePath(); - if(!path.isEmpty() && !libdirs.contains(path)) + if (!path.isEmpty() && !libdirs.contains(path) + && !defaultLibDirs.contains(path)) { libdirs += path; + } } library = fileFixify(library, FileFixifyFromOutdir | FileFixifyAbsolute); QString key = keyFor(library); From b9b48464df15de89d3dccb78944e89c1668466bf Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 20 Aug 2019 14:00:22 +0200 Subject: [PATCH 12/15] tst_http2::goaway - run in ALPN mode only I was observing rare crashes on my mac, where I was using SecureTransport. This would imply both the client (the test) and the server were working in h2c mode. But this is against the test's logic - the first request will be HTTP/1.1 (and upgrading protocol) and I wanted to send 3 HTTP/2 requests instead. Fixes: QTBUG-77476 Change-Id: I048ca242e2096ca36dd112277807d1fee530150c Reviewed-by: Edward Welbourne --- tests/auto/network/access/http2/tst_http2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 4b4b8d541a..fe40d1c723 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -455,6 +455,9 @@ void tst_Http2::goaway_data() // - server waits for some time (enough for ur to init several streams on a // client side); then suddenly it replies with GOAWAY, never processing any // request. + if (clearTextHTTP2) + QSKIP("This test requires TLS with ALPN to work"); + QTest::addColumn("responseTimeoutMS"); QTest::newRow("ImmediateGOAWAY") << 0; QTest::newRow("DelayedGOAWAY") << 1000; From 15edba41014690332f4753f932fa7d928096cb73 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 3 Sep 2019 07:49:32 -0700 Subject: [PATCH 13/15] qFatal: make it so you cannot disable the message Solves a few recursion problems in Qt, since then we won't try to inspect the logging registry while creating the logging registry. Fixes: QTBUG-78007 Change-Id: I44cc9ee732f54d2380bafffd15c0f51c7140682e Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Friedemann Kleint --- src/corelib/global/qlogging.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index bf9c2ed2be..3c82097cfe 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1814,8 +1814,8 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex #ifndef QT_BOOTSTRAPPED Q_TRACE(qt_message_print, msgType, context.category, context.function, context.file, context.line, message); - // qDebug, qWarning, ... macros do not check whether category is enabled - if (isDefaultCategory(context.category)) { + // qDebug, qWarning, ... macros do not check whether category is enabledgc + if (msgType != QtFatalMsg && isDefaultCategory(context.category)) { if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) { if (!defaultCategory->isEnabled(msgType)) return; From a42a4513398a159e4f6749fbcb1309c4a42b4841 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 30 Aug 2019 22:06:17 +0200 Subject: [PATCH 14/15] QShortcut: call base class implementation in event() QShortcut::event() did not call the base class implementation QObject::event() which caused that e.g. QEvent::DeferredDelete was not handled. Fix it by calling QObject::event() when the event was not handled. Fixes: QTBUG-66809 Change-Id: Ideebc980bc658f8f2b9ec4417e738bccda5eeab5 Reviewed-by: Volker Hilsheimer --- src/widgets/kernel/qshortcut.cpp | 6 ++---- tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index b7857e2b74..db06dce042 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -665,24 +665,22 @@ int QShortcut::id() const bool QShortcut::event(QEvent *e) { Q_D(QShortcut); - bool handled = false; if (d->sc_enabled && e->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast(e); if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){ #if QT_CONFIG(whatsthis) if (QWhatsThis::inWhatsThisMode()) { QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis); - handled = true; } else #endif if (se->isAmbiguous()) emit activatedAmbiguously(); else emit activated(); - handled = true; + return true; } } - return handled; + return QObject::event(e); } #endif // QT_NO_SHORTCUT diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index 2c9295d995..53753e195a 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -123,6 +123,7 @@ private slots: void context(); void duplicatedShortcutOverride(); void shortcutToFocusProxy(); + void deleteLater(); protected: static Qt::KeyboardModifiers toButtons( int key ); @@ -1305,5 +1306,14 @@ void tst_QShortcut::shortcutToFocusProxy() QCOMPARE(le.text(), QString()); } +void tst_QShortcut::deleteLater() +{ + QWidget w; + QPointer sc(new QShortcut(QKeySequence(Qt::Key_1), &w)); + sc->deleteLater(); + QTRY_VERIFY(!sc); +} + + QTEST_MAIN(tst_QShortcut) #include "tst_qshortcut.moc" From d1a22bd29856807805fa56608d2953c072df0cf1 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 4 Sep 2019 15:00:31 +0200 Subject: [PATCH 15/15] A follow-up to a recent fix in QHttpNetworkConnectionChannel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While working with HTTP/2, we are not re-sending failed requests. In case we receive a GOAWAY frame, we properly handle it by processing some active streams if possible, and aborting streams that will not proceed further with ContentResendError. But it's possible that some server failed to send us GOAWAY (for example, it died) or closed the connection not finishing the streams that were still active and valid (ID <= value from GOAWAY frame). Now that we will not re-connect, there is no reason to be quiet about us not progressing - emit RemoteHostClosedError on any remaining active stream/request we cannot process further. Fixes: QTBUG-77852 Change-Id: I4cd68a1c8c103b1fbe36c20a1cc406ab2e20dd12 Reviewed-by: Mårten Nordheim Reviewed-by: Timur Pocheptsov (cherry picked from commit 543769666f18f79bd6ebd6119a39834aafc2b0df) --- src/network/access/qhttp2protocolhandler.cpp | 25 +++++++++++++++++++ src/network/access/qhttp2protocolhandler_p.h | 2 ++ .../access/qhttpnetworkconnectionchannel.cpp | 13 +++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 5d7fc7506e..6609aa0594 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -55,6 +55,8 @@ #include #endif +#include + #include #include @@ -211,6 +213,29 @@ QHttp2ProtocolHandler::QHttp2ProtocolHandler(QHttpNetworkConnectionChannel *chan } } +void QHttp2ProtocolHandler::handleConnectionClosure() +{ + // The channel has just received RemoteHostClosedError and since it will + // not try (for HTTP/2) to re-connect, it's time to finish all replies + // with error. + + // Maybe we still have some data to read and can successfully finish + // a stream/request? + _q_receiveReply(); + + // Finish all still active streams. If we previously had GOAWAY frame, + // we probably already closed some (or all) streams with ContentReSend + // error, but for those still active, not having any data to finish, + // we now report RemoteHostClosedError. + const auto errorString = QCoreApplication::translate("QHttp", "Connection closed"); + for (auto it = activeStreams.begin(), eIt = activeStreams.end(); it != eIt; ++it) + finishStreamWithError(it.value(), QNetworkReply::RemoteHostClosedError, errorString); + + // Make sure we'll never try to read anything later: + activeStreams.clear(); + goingAway = true; +} + void QHttp2ProtocolHandler::_q_uploadDataReadyRead() { if (!sender()) // QueuedConnection, firing after sender (byte device) was deleted. diff --git a/src/network/access/qhttp2protocolhandler_p.h b/src/network/access/qhttp2protocolhandler_p.h index 9165808302..d91853f613 100644 --- a/src/network/access/qhttp2protocolhandler_p.h +++ b/src/network/access/qhttp2protocolhandler_p.h @@ -90,6 +90,8 @@ public: QHttp2ProtocolHandler &operator = (const QHttp2ProtocolHandler &rhs) = delete; QHttp2ProtocolHandler &operator = (QHttp2ProtocolHandler &&rhs) = delete; + Q_INVOKABLE void handleConnectionClosure(); + private slots: void _q_uploadDataReadyRead(); void _q_replyDestroyed(QObject* reply); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index e7af7b648e..1fac24ab49 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -967,7 +967,18 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket if (!reply && state == QHttpNetworkConnectionChannel::IdleState) { // Not actually an error, it is normal for Keep-Alive connections to close after some time if no request // is sent on them. No need to error the other replies below. Just bail out here. - // The _q_disconnected will handle the possibly pipelined replies + // The _q_disconnected will handle the possibly pipelined replies. HTTP/2 is special for now, + // we do not resend, but must report errors if any request is in progress (note, while + // not in its sendRequest(), protocol handler switches the channel to IdleState, thus + // this check is under this condition in 'if'): + if (protocolHandler.data()) { + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct + || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { + auto h2Handler = static_cast(protocolHandler.data()); + h2Handler->handleConnectionClosure(); + protocolHandler.reset(); + } + } return; } else if (state != QHttpNetworkConnectionChannel::IdleState && state != QHttpNetworkConnectionChannel::ReadingState) { // Try to reconnect/resend before sending an error.