From 50b9d8a931e859c027726a74ea0616e7b292e782 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 18 Oct 2016 19:12:55 +0200 Subject: Windows: Fix regression in QFSFileEnginePrivate::nativeWrite() Change 0696566b1e19c8178e00c0d14f185935e17d9e8b caused the block size to be incorrect for data > 32MB. Since bytesToWrite changes within the do...while loop, then the block size can potentially change too each time. So it needs to be recalculated each time rather than just once. Task-number: QTBUG-56616 Change-Id: I9880d0985f2d0242c30e67230be7271eb806db95 Reviewed-by: Oliver Wolff Reviewed-by: Friedemann Kleint (cherry picked from commit 683c9bc4a8e656b2251871b9d8c9952e58681a52) --- src/corelib/io/qfsfileengine_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index af026b8976..3251c481dd 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -433,11 +433,11 @@ qint64 QFSFileEnginePrivate::nativeWrite(const char *data, qint64 len) // Writing on Windows fails with ERROR_NO_SYSTEM_RESOURCES when // the chunks are too large, so we limit the block size to 32MB. - const DWORD blockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024))); qint64 totalWritten = 0; do { + const DWORD currentBlockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024))); DWORD bytesWritten; - if (!WriteFile(fileHandle, data + totalWritten, blockSize, &bytesWritten, NULL)) { + if (!WriteFile(fileHandle, data + totalWritten, currentBlockSize, &bytesWritten, NULL)) { if (totalWritten == 0) { // Note: Only return error if the first WriteFile failed. q->setError(QFile::WriteError, qt_error_string()); -- cgit v1.2.3 From ab0ba668642d2d4c941f57e949118327530234af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 3 Oct 2016 18:41:30 +0200 Subject: Apple OS: Handle QSetting strings with embedded zero-bytes Saving strings with embedded zero-bytes (\0) as CFStrings would sometimes fail, and only write the part of the string leading up to the first zero-byte, instead of all the way to the final zero-terminator. This bug was revealed by the code-path that falls back to storing e.g. QTime as strings, via the helper method QSettingsPrivate::variantToString(). We now use the same approach as on platforms such as Windows and WinRT, where the string produced by variantToString() is checked for null-bytes, and if so, stored using a binary representation instead of as a string. For our case that means we fall back to CFData when detecting the null-byte. To separate strings from regular byte arrays, new logic has been added to variantToString() that wraps the null-byte strings in @String(). That way we can implement a fast-path when converting back from CFData, that doesn't go via the slow and lossy conversion via UTF8, and the resulting QVariant will be of type QVariant::ByteArray. The reason for using UTF-8 as the binary representation of the string is that in the case of storing a QByteArray("@foo") we need to still be able to convert it back to the same byte array, which doesn't work if the on-disk format is UTF-16. Task-number: QTBUG-56124 Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8 Cherry-picked: 764f5bf48cc87f4c72550b853ab93b815454cd48 Reviewed-by: Thiago Macieira Reviewed-by: Jani Heikkinen --- src/corelib/io/qsettings.cpp | 6 ++- src/corelib/io/qsettings_mac.cpp | 20 ++++++++- src/corelib/io/qsettings_win.cpp | 13 +----- src/corelib/io/qsettings_winrt.cpp | 4 +- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 50 ++++++++++++++++++++++- 5 files changed, 76 insertions(+), 17 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 8bdd148e28..05f6c22fc2 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -417,7 +417,9 @@ QString QSettingsPrivate::variantToString(const QVariant &v) case QVariant::Double: case QVariant::KeySequence: { result = v.toString(); - if (result.startsWith(QLatin1Char('@'))) + if (result.contains(QChar::Null)) + result = QLatin1String("@String(") + result + QLatin1Char(')'); + else if (result.startsWith(QLatin1Char('@'))) result.prepend(QLatin1Char('@')); break; } @@ -477,6 +479,8 @@ QVariant QSettingsPrivate::stringToVariant(const QString &s) if (s.endsWith(QLatin1Char(')'))) { if (s.startsWith(QLatin1String("@ByteArray("))) { return QVariant(s.midRef(11, s.size() - 12).toLatin1()); + } else if (s.startsWith(QLatin1String("@String("))) { + return QVariant(s.midRef(8, s.size() - 9).toString()); } else if (s.startsWith(QLatin1String("@Variant(")) || s.startsWith(QLatin1String("@DateTime("))) { #ifndef QT_NO_DATASTREAM diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index d73cc4d298..4282fcbe2c 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -214,7 +214,14 @@ static QCFType macValue(const QVariant &value) case QVariant::String: string_case: default: - result = QCFString::toCFStringRef(QSettingsPrivate::variantToString(value)); + QString string = QSettingsPrivate::variantToString(value); + if (string.contains(QChar::Null)) { + QByteArray ba = string.toUtf8(); + result = CFDataCreate(kCFAllocatorDefault, reinterpret_cast(ba.data()), + CFIndex(ba.size())); + } else { + result = QCFString::toCFStringRef(string); + } } return result; } @@ -267,8 +274,17 @@ static QVariant qtValue(CFPropertyListRef cfvalue) return (bool)CFBooleanGetValue(static_cast(cfvalue)); } else if (typeId == CFDataGetTypeID()) { CFDataRef cfdata = static_cast(cfvalue); - return QByteArray(reinterpret_cast(CFDataGetBytePtr(cfdata)), + QByteArray byteArray = QByteArray(reinterpret_cast(CFDataGetBytePtr(cfdata)), CFDataGetLength(cfdata)); + + // Fast-path for QByteArray, so that we don't have to go + // though the expensive and lossy conversion via UTF-8. + if (!byteArray.startsWith('@')) + return byteArray; + + const QString str = QString::fromUtf8(byteArray.constData(), byteArray.size()); + return QSettingsPrivate::stringToVariant(str); + } else if (typeId == CFDictionaryGetTypeID()) { CFDictionaryRef cfdict = static_cast(cfvalue); CFTypeID arrayTypeId = CFArrayGetTypeID(); diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 05ed51e999..53e1ed360b 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -675,15 +675,6 @@ void QWinSettingsPrivate::remove(const QString &uKey) } } -static bool stringContainsNullChar(const QString &s) -{ - for (int i = 0; i < s.length(); ++i) { - if (s.at(i).unicode() == 0) - return true; - } - return false; -} - void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) { if (writeHandle() == 0) { @@ -712,7 +703,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) QStringList l = variantListToStringList(value.toList()); QStringList::const_iterator it = l.constBegin(); for (; it != l.constEnd(); ++it) { - if ((*it).length() == 0 || stringContainsNullChar(*it)) { + if ((*it).length() == 0 || it->contains(QChar::Null)) { type = REG_BINARY; break; } @@ -756,7 +747,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) // If the string does not contain '\0', we can use REG_SZ, the native registry // string type. Otherwise we use REG_BINARY. QString s = variantToString(value); - type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ; + type = s.contains(QChar::Null) ? REG_BINARY : REG_SZ; if (type == REG_BINARY) { regValueBuff = QByteArray((const char*)s.utf16(), s.length() * 2); } else { diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 708287ce5e..209b56d920 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -402,7 +402,7 @@ void QWinRTSettingsPrivate::set(const QString &uKey, const QVariant &value) QStringList::const_iterator it = l.constBegin(); bool containsNull = false; for (; it != l.constEnd(); ++it) { - if ((*it).length() == 0 || it->indexOf(QChar::Null) != -1) { + if ((*it).length() == 0 || it->contains(QChar::Null)) { // We can only store as binary containsNull = true; break; @@ -445,7 +445,7 @@ void QWinRTSettingsPrivate::set(const QString &uKey, const QVariant &value) break; default: { const QString s = variantToString(value); - if (s.indexOf(QChar::Null) != -1) { + if (s.contains(QChar::Null)) { hr = valueStatics->CreateUInt8Array(s.length() * 2, (BYTE*) s.utf16(), &val); } else { HStringReference ref((const wchar_t*)s.utf16(), s.size()); diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 87a801c9dd..ed298bfafa 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -158,6 +158,8 @@ private slots: void testByteArray(); void iniCodec(); void bom(); + void embeddedZeroByte_data(); + void embeddedZeroByte(); private: void cleanupTestFiles(); @@ -627,7 +629,6 @@ void tst_QSettings::testByteArray_data() #ifndef QT_NO_COMPRESS QTest::newRow("compressed") << qCompress(bytes); #endif - QTest::newRow("with \\0") << bytes + '\0' + bytes; } void tst_QSettings::testByteArray() @@ -678,6 +679,53 @@ void tst_QSettings::bom() QVERIFY(allkeys.contains("section2/foo2")); } +void tst_QSettings::embeddedZeroByte_data() +{ + QTest::addColumn("value"); + + QByteArray bytes("hello\0world", 11); + + QTest::newRow("bytearray\\0") << QVariant(bytes); + QTest::newRow("string\\0") << QVariant(QString::fromLatin1(bytes.data(), bytes.size())); + + bytes = QByteArray("@String("); + + QTest::newRow("@bytearray") << QVariant(bytes); + QTest::newRow("@string") << QVariant(QString(bytes)); + + bytes = QByteArray("@String(\0test", 13); + + QTest::newRow("@bytearray\\0") << QVariant(bytes); + QTest::newRow("@string\\0") << QVariant(QString::fromLatin1(bytes.data(), bytes.size())); +} + +void tst_QSettings::embeddedZeroByte() +{ + QFETCH(QVariant, value); + { + QSettings settings("QtProject", "tst_qsettings"); + settings.setValue(QTest::currentDataTag(), value); + } + { + QSettings settings("QtProject", "tst_qsettings"); + QVariant outValue = settings.value(QTest::currentDataTag()); + + switch (value.type()) { + case QVariant::ByteArray: + QCOMPARE(outValue.toByteArray(), value.toByteArray()); + break; + case QVariant::String: + QCOMPARE(outValue.toString(), value.toString()); + break; + default: + Q_UNREACHABLE(); + } + + if (value.toByteArray().contains(QChar::Null)) + QVERIFY(outValue.toByteArray().contains(QChar::Null)); + } +} + void tst_QSettings::testErrorHandling_data() { QTest::addColumn("filePerms"); // -1 means file should not exist -- cgit v1.2.3 From 65858057f0f76908e4734fd06e0cfaeb2ee233cd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 10 Oct 2016 13:57:33 +0200 Subject: configure: Determine MSVC version by evaluating macro _MSC_FULL_VER The previously used regular expression failed for messages in local languages, particularly for the French message containing a non-breaking space. Task-number: QTBUG-56388 Change-Id: Ie757617f1b3a31820d0ed274c4b157d544ac1ea6 Reviewed-by: Oswald Buddenhagen (cherry picked from commit 1bd53131d83cdf595f95f82f0c049d2d68957159) --- tools/configure/environment.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 1a05c9ce62..8f18f3c489 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -150,24 +151,23 @@ QString Environment::gccVersion() QString Environment::msvcVersion() { int returnValue = 0; - // Extract version from standard error output of "cl /?" - const QString command = QFile::decodeName(qgetenv("ComSpec")) - + QLatin1String(" /c ") + QLatin1String(compilerInfo(CC_MSVC2015)->executable) - + QLatin1String(" /? 2>&1"); - QString version = execute(command, &returnValue); - if (returnValue != 0) { - cout << "Could not get cl version" << returnValue << qPrintable(version) << '\n';; - version.clear(); - } else { - QRegExp versionRegexp(QStringLiteral("^.*Compiler Version ([0-9.]+) for.*$")); - Q_ASSERT(versionRegexp.isValid()); - if (versionRegexp.exactMatch(version)) { - version = versionRegexp.cap(1); - } else { - cout << "Unable to determine cl version from the output of \"" - << qPrintable(command) << "\"\n"; - } + QString tempSourceName; + { // QTemporaryFile needs to go out of scope, otherwise cl.exe refuses to open it. + QTemporaryFile tempSource(QDir::tempPath() + QLatin1String("/XXXXXX.cpp")); + tempSource.setAutoRemove(false); + if (!tempSource.open()) + return QString(); + tempSource.write("_MSC_FULL_VER\n"); + tempSourceName = tempSource.fileName(); } + QString version = execute(QLatin1String("cl /nologo /EP \"") + + QDir::toNativeSeparators(tempSourceName) + QLatin1Char('"'), + &returnValue).trimmed(); + QFile::remove(tempSourceName); + if (returnValue || version.size() < 9 || !version.at(0).isDigit()) + return QString(); + version.insert(4, QLatin1Char('.')); + version.insert(2, QLatin1Char('.')); return version; } -- cgit v1.2.3 From 3f347262da369b0a4adae89750f9fe0247fcd486 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 25 Oct 2016 12:12:09 -0700 Subject: Add changes file for 5.7.1 Change-Id: I96f1a5d4d7b559f7c5d3aba3c45eb77744b35cb5 Reviewed-by: Lars Knoll Reviewed-by: Timur Pocheptsov Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Thiago Macieira --- dist/changes-5.7.1 | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 dist/changes-5.7.1 diff --git a/dist/changes-5.7.1 b/dist/changes-5.7.1 new file mode 100644 index 0000000000..83065f01c1 --- /dev/null +++ b/dist/changes-5.7.1 @@ -0,0 +1,221 @@ +Qt 5.7.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.7.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.7 series is binary compatible with the 5.6.x series. +Applications compiled for 5.6 will continue to run with 5.7. + +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. + +This release contains all fixes included in the Qt 5.6.2 release. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - [QTBUG-45031] The NSURLConnection backend of QNetworkAccessManager has + been removed, since SecureTransport is the default SSL backend on iOS + and is enabled by default. This means that building with -no-openssl + -no-securetransport will no longer provide SSL capabilities on iOS. + + - QtCore / QDataStream: + * [QTBUG-54022] Incomplete reads of Qt containers are now handled same + way as for primitive types, meaning that previous errors are latched. + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - QLockFile: + * Fixed permissions on lock files on Unix to allow for adjustments via + umask. + + - QMimeType: + * [QTBUG-50776] QMimeType::comment() now uses the default locale rather + than system locale, so that applications can control which language is + being used. + + - QUrl: + * QUrl::resolved() no longer treats a URL with a scheme as a relative URL + if it matches this URL's scheme. For now it still treats "file:name.txt" + as relative for compatibility, but be warned that in Qt 5.8 it will no + longer consider those to be relative. Both isRelative() and RFC 3986 say + that such URLs are not relative, so starting from Qt 5.8, resolved() will + return them as is. + + - QXmlStreamReader: + * Fixed a bug in the XML parser that prevented to load XML that + contained invalid characters for XML 1.0. + + - QXmlStreamWriter: + * Fixed a bug that prevented the generation of valid XML files when + using encoding with 8 bit per character but not ASCII compatible. + QXMLStreamWriter generated XML markup using always ASCII in this case. + +QtGui +----- + + - QGuiApplication: + * [QTBUG-51703] Fixed a bug that would cause QGuiApplication::sync() to + be left undefined for Qt builds without session management support. + + - QIconLoaderEngine: + * Fixed theme lookup for scalable entries + + - QTextDocument: + * [QTBUG-48182] Fixed a bug that would return a wrong position when + searching backward from the end of the document. + + - Text: + * [QTBUG-49452] Fixed a performance regression in Freetype engine that + was introduced in Qt 5.5. + * [QTBUG-53911] Fixed a crash that could happen if you were doing many + different text layouts with different fonts and superscript or + subscript alignment. + * [QTBUG-42033] Fixed bug where a QTextLayout with + ShowLineAndParagraphSeparators would modify the layout's input string. + * [QTBUG-54180] Fixed performance regression when rapidly switching + between a large set of fonts. + +QtNetwork +--------- + +- QSslSocket: + * [QTBUG-55170] Fixed a bug in SecureTransport backend that would cause + a memory usage growth in case 'readBufferMaxSize' is set. + * [QTBUG-52975] Fixed a bug in SecureTransport backend where transmit + was using invalid SSL context and reporting (incorrectly) some irrelevant + errors as a result. + +QtSql +----- + + - [QTBUG-53969][QTBUG-53237] Fixed QSqlQuery::prepare value truncation + error when using UNSIGNED values in a MySQL database. + +QtWidgets +--------- + + - QAbstractItemDelegate: + * [QTBUG-16469] Show localized detailed tooltips and "What's this?" + texts. + + - QTreeView: + * [QTBUG-52793] Fixed a key navigation bug when the columns were + reordered. + +**************************************************************************** +* Platform-specific Changes * +**************************************************************************** + +Android +------- + + - [QTBUG-50724] Added support for clang compiler + - [QTBUG-53511] Fixed CJK font resolution on Android 7. + +FreeBSD +------- + + - The freebsd-g++ mkspec was moved back and no longer requires the + "unsupported/" prefix, matching the FreeBSD ports tree, as FreeBSD 9.3 + still defaults to using GCC. Users of GCC that did not previously use + the ports patch will need to adapt their build scripts and drop the + "unsupported/" prefix. + +Linux +----- + +- [QTBUG-54733] It is now possible to opt out from installing signal + handlers when running with eglfs and linuxfb by setting the + QT_QPA_NO_SIGNAL_HANDLER environment variable to a non-zero value. +- [QTBUG-55140] xcb with EGL and OpenGL ES, as well as eglfs with the + eglfs_x11 backend, are now supported on DRIVE CX boards when using the + linux-drive-cx-g++ device spec. + + +Windows +------- + + - [QTBUG-41186] QWindow::fromWinId() may return 0 when passing invalid + window handles. + - [QTBUG-55595] Fixed crash when loading color fonts from data. + - [QTBUG-55097] Fixed rendering Adobe/Mozilla format color fonts with + other colors than black after Windows 10 Anniversary update. + - [QTBUG-54494] Fixed stretch when combined with either no or vertical + hinting preference or a device pixel ratio different from 1. + - [QTBUG-51024] Fixed height of text bounding box when using no or + vertical hinting preference, or when the device pixel ratio is + different from 1. + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-35886][QTBUG-51417] Fixed Fontconfig vs. system FreeType + configuration. + - [QTBUG-43784][X11] Fixed detection of GLX with -qt-xcb. + - [QTBUG-51534][Windows] The configure.exe bootstrapping now prefers + cl over clang-cl, to avoid header incompatibility problems. + - [QTBUG-52940] Fixed missing plugins.qmltypes files in static builds. + - [QTBUG-52951] Fixed dynamic library support detection for platforms + without libdl. + - [QTBUG-53038] Fixed running of configure tests outside qtbase when + cross compiling on Windows (for example for Android). + - [QTBUG-53312] The flags supplied by the configure -D/-I/-L/-l options + are now applied after Qt's own flags. This helps in some cases when + the provided paths contain files which conflict with the Qt build. + - [QTBUG-53926] Fixed linkage of QML plugins in static prefix builds. + - [QTBUG-55011][Unix] Fixed -no-pkg-config being ignored by some + configure tests, which led to build failures later on. + - Fixed configure tests outside qtbase when $MAKEFLAGS contains the + -i flag. + - [Android] Some unused plugins are not built anymore. + - [MinGW] Added support for -separate-debug-info. + - [Unix] Added configure -no-opengles3 option. + - [Unix] Fixed MySQL detection/use on RHEL 6.6. + +qmake +----- + + - [QTBUG-41830] Fixed nested custom functions inheriting their callers' + arguments. + - [QTBUG-53895][MSVC] Started using separate PDB files for compiling + and linking. + - [QTBUG-54036][Darwin] Fixed installation of debug symbols. + - [QTBUG-54299] Various QMAKE_EXTRA_COMPILERS' .depends entries are now + appended to rather than overwritten. + - [QTBUG-54346][MSys/Apple] Fixed detection of QMAKE_DEFAULT_{INC,LIB}DIRS. + - [QTBUG-54550] Fixed access to freed memory in $$absolute_path(). + - [QTBUG-54674] The obsolete -target xp is now properly rejected. + - [QTBUG-55183][nmake] _WINDLL is now automatically defined when building + a DLL, consistently with Visual Studio. + - [QTBUG-55505] Fixed build of projects with spaces in the source or build + path against static builds of Qt. + - [QTBUG-55649][QTBUG-55915][Xcode] Fixed support for Xcode 8. + - [QTBUG-56162][MinGW] Fixed -release -force-debug-info missing both + optimization and debug info. + - Fixed several cases where the error() function would not abort qmake. + - Interrupting a command run via system() will now abort qmake as well. + - The packagesExist() function will now warn when used when Qt was + configured with -no-pkg-config. + - [Android] The default compiler flags were adjusted to match newer + NDK versions. + - [Darwin] Fixed detection of QMAKE_DEFAULT_INCDIRS. + - [Darwin][make] Added support for building Xcode asset catalogs. -- cgit v1.2.3 From e79b40ee8f78a9669ed0b7b6def2a69ef7ab02fa Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 1 Nov 2016 15:28:17 -0700 Subject: macOS: Clear event dispatcher interrupt state A pending interrupt of a QEventLoop may interfere with native runModal calls, resulting in Cocoa's main event loop to be stopped unexpectedly. After commit 9ab60b9c processEvents() no longer resets the event dispatcher interrupt flag. Add QCocoaEventDispatcher::clearCurrentThreadCocoa EventDispatcherInterruptFlag(). Use it to clear the interrupt state before calling runModal and variants. Work around the inability to use platform API in the print support code. Change-Id: I3e03e7ec21ff6c49442c7a6e803a7200aac0b58d Task-number: QTBUG-56746 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 5 +++++ src/plugins/platforms/cocoa/qcocoaeventdispatcher.h | 2 ++ src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 13 +++++++++++++ src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 5 +++++ src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 5 +++++ src/plugins/platforms/cocoa/qcocoanativeinterface.h | 2 ++ src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 6 ++++++ src/printsupport/dialogs/qpagesetupdialog_mac.mm | 5 +++++ src/printsupport/dialogs/qprintdialog_mac.mm | 5 +++++ 9 files changed, 48 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 0319d4ca6d..7d12804d47 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -45,6 +45,7 @@ #include "qcocoacolordialoghelper.h" #include "qcocoahelpers.h" +#include "qcocoaeventdispatcher.h" #import @@ -322,6 +323,10 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will // close down during the cleanup. qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + + // Make sure we don't interrupt the runModalForWindow call. + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + [NSApp runModalForWindow:mColorPanel]; mDialogIsExecuting = false; return (mResultCode == NSOKButton); diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h index 84880d51c5..70887c41c9 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -131,6 +131,8 @@ public: void interrupt(); void flush(); + static void clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + friend void qt_mac_maybeCancelWaitForMoreEventsForwarder(QAbstractEventDispatcher *eventDispatcher); }; diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 5c27cf8059..d9c835d797 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -966,6 +966,19 @@ void QCocoaEventDispatcher::interrupt() void QCocoaEventDispatcher::flush() { } +// QTBUG-56746: The behavior of processEvents() has been changed to not clear +// the interrupt flag. Use this function to clear it. + void QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag() +{ + QCocoaEventDispatcher *cocoaEventDispatcher = + qobject_cast(QThread::currentThread()->eventDispatcher()); + if (!cocoaEventDispatcher) + return; + QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = + static_cast(QObjectPrivate::get(cocoaEventDispatcher)); + cocoaEventDispatcherPrivate->interrupt = false; +} + QCocoaEventDispatcher::~QCocoaEventDispatcher() { Q_D(QCocoaEventDispatcher); diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4eb35f5495..c7191e4841 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -53,6 +53,7 @@ #include "qt_mac_p.h" #include "qcocoahelpers.h" #include "qcocoamenubar.h" +#include "qcocoaeventdispatcher.h" #include #include #include @@ -243,6 +244,10 @@ static QString strippedText(QString s) // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will // close down during the cleanup. qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + + // Make sure we don't interrupt the runModal call below. + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder(); mReturnCode = [mSavePanel runModal]; QCocoaMenuBar::resetKnownMenuItemsToQt(); diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index dc7dfb788f..d0b76861d8 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -49,6 +49,7 @@ #include "qcocoafontdialoghelper.h" #include "qcocoahelpers.h" +#include "qcocoaeventdispatcher.h" #import @@ -319,6 +320,10 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will // close down during the cleanup. qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + + // Make sure we don't interrupt the runModalForWindow call. + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + [NSApp runModalForWindow:mFontPanel]; mDialogIsExecuting = false; return (mResultCode == NSOKButton); diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index 7065a364bf..b06fff1375 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -100,6 +100,8 @@ private: */ Q_INVOKABLE QPixmap defaultBackgroundPixmapForQWizard(); + Q_INVOKABLE void clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + // QMacPastebardMime support. The mac pasteboard void pointers are // QMacPastebardMime instances from the cocoa plugin or qtmacextras // These two classes are kept in sync and can be casted between. diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 8562246817..a327750ffd 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -44,6 +44,7 @@ #include "qcocoahelpers.h" #include "qcocoaapplication.h" #include "qcocoaintegration.h" +#include "qcocoaeventdispatcher.h" #include #include @@ -194,6 +195,11 @@ QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() return QPixmap(); } +void QCocoaNativeInterface::clearCurrentThreadCocoaEventDispatcherInterruptFlag() +{ + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); +} + void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window) { Q_UNUSED(window); diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm index e3e7523a16..c29b911e35 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm +++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm @@ -133,6 +133,11 @@ void QMacPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithNSPrintInfo:printInfo]; if (modality == Qt::ApplicationModal) { + + // Make sure we don't interrupt the runModalWithPrintInfo call. + (void) QMetaObject::invokeMethod(qApp->platformNativeInterface(), + "clearCurrentThreadCocoaEventDispatcherInterruptFlag"); + int rval = [pageLayout runModalWithPrintInfo:printInfo]; [delegate pageLayoutDidEnd:pageLayout returnCode:rval contextInfo:q]; } else { diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index c16bb93013..c630ab634a 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -245,6 +245,11 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality) if (modality == Qt::ApplicationModal || !q->parentWidget()) { if (modality == Qt::NonModal) qWarning("QPrintDialog is required to be modal on OS X"); + + // Make sure we don't interrupt the runModalWithPrintInfo call. + (void) QMetaObject::invokeMethod(qApp->platformNativeInterface(), + "clearCurrentThreadCocoaEventDispatcherInterruptFlag"); + int rval = [printPanel runModalWithPrintInfo:printInfo]; [delegate printPanelDidEnd:printPanel returnCode:rval contextInfo:q]; } else { -- cgit v1.2.3 From 3654a401f8e046e2fa5a340d0380cc0088a03048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 27 Oct 2016 09:57:54 +0200 Subject: Prevent stale QOpenGLContext fbo pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is logic for clearing the qgl_curent_fbo pointer in release(), but it is not always called, causing the pointer to become stale on QOpenGLFramebufferObject deletion. As a last resort, clear the qgl_curent_fbo pointer on the current context if it’s pointing to the object that is being deleted. Change-Id: I0a91d686cec5fcbe4c1520a9ba96cea833bb2249 Task-number: QTBUG-56639 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qopenglcontext_p.h | 2 +- src/gui/opengl/qopenglframebufferobject.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 2fe8446c65..736f816bfe 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -264,7 +264,7 @@ public: static QOpenGLContextPrivate *get(QOpenGLContext *context) { - return context->d_func(); + return context ? context->d_func() : Q_NULLPTR; } #if !defined(QT_NO_DEBUG) diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 14581c89f6..be5407ccbd 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -955,6 +955,12 @@ QOpenGLFramebufferObject::~QOpenGLFramebufferObject() d->stencil_buffer_guard->free(); if (d->fbo_guard) d->fbo_guard->free(); + + QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(QOpenGLContext::currentContext()); + if (contextPrv && contextPrv->qgl_current_fbo == this) { + contextPrv->qgl_current_fbo_invalid = true; + contextPrv->qgl_current_fbo = Q_NULLPTR; + } } /*! -- cgit v1.2.3 From 35953be53bfe06f01f6b8cfde70d7e793341e481 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 7 Oct 2016 20:16:58 +0200 Subject: fix xcodebuilds without -sdk iphonesimulator the order of the arguments passed to addExclusiveBuilds() determines the name of the CONFIG flag which actually enables the mode. that is historically fixed to iphonesimulator_and_iphoneos and we cannot just change the order. to get around this, add a new "overload" of the function which allows specifying the flag independently from the order of the builds, and make use of it in ios' resolve_config.prf. amends d2b4a789c. Change-Id: Ia3fabea0c0c30beae680b57e75bdcdf35ef6503d (cherry picked from 59985b3c291f769cfc24cf361367757fce229397) Reviewed-by: Jake Petroules Reviewed-by: Oswald Buddenhagen --- mkspecs/features/exclusive_builds.prf | 18 +++++++++++------- mkspecs/macx-ios-clang/features/resolve_config.prf | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/mkspecs/features/exclusive_builds.prf b/mkspecs/features/exclusive_builds.prf index 5d06198ae4..f40cc99172 100644 --- a/mkspecs/features/exclusive_builds.prf +++ b/mkspecs/features/exclusive_builds.prf @@ -1,12 +1,9 @@ -defineTest(addExclusiveBuilds) { - lessThan(ARGC, 2): \ - error("addExclusiveBuilds() requires at least two arguments") - - !$$join(ARGS, _and_):!fix_output_dirs: \ +defineTest(addExclusiveBuildsProper) { + !$$1:!fix_output_dirs: \ return(true) - for(build, ARGS) { + for(build, 2) { isEmpty($${build}.name) { $${build}.name = $$title($$build) export($${build}.name) @@ -20,7 +17,7 @@ defineTest(addExclusiveBuilds) { export($${build}.dir_affix) } - $${build}.exclusive = $$ARGS + $${build}.exclusive = $$2 export($${build}.exclusive) QMAKE_EXCLUSIVE_BUILDS += $$build @@ -33,6 +30,13 @@ defineTest(addExclusiveBuilds) { return(true) } +defineTest(addExclusiveBuilds) { + lessThan(ARGC, 2): \ + error("addExclusiveBuilds() requires at least two arguments") + + addExclusiveBuildsProper($$join(ARGS, _and_), $$ARGS) +} + # Default directories to process QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR QGLTF_DIR DESTDIR QMAKE_DIR_REPLACE_SANE += QGLTF_DIR diff --git a/mkspecs/macx-ios-clang/features/resolve_config.prf b/mkspecs/macx-ios-clang/features/resolve_config.prf index a964ee3278..22d962af38 100644 --- a/mkspecs/macx-ios-clang/features/resolve_config.prf +++ b/mkspecs/macx-ios-clang/features/resolve_config.prf @@ -32,9 +32,9 @@ macx-xcode { } else { # Switch the order to make sure that the first Makefile target is the right one !contains(QT_CONFIG, simulator_and_device):contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \ - addExclusiveBuilds(simulator, device) + addExclusiveBuildsProper(simulator_and_device, simulator device) else: \ - addExclusiveBuilds(device, simulator) + addExclusiveBuildsProper(simulator_and_device, device simulator) } equals(TEMPLATE, subdirs) { -- cgit v1.2.3 From db6c31af0177025f178cb42d5febbdc47dc87778 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Fri, 11 Nov 2016 12:34:54 -0800 Subject: qmake: fix installation of asset catalog files This strips leading whitespace from asset catalog filenames, which was causing installation to fail due to incorrectly calculated paths. Task-number: QTBUG-57090 Change-Id: I80db627262f9d58f4403e2d8ab205bef2113992b (cherry picked from commit addf1f45f3e2c37a09ef7f7bab909467c2bf79f7) Reviewed-by: Jake Petroules Reviewed-by: Oswald Buddenhagen --- mkspecs/features/mac/asset_catalogs.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/mac/asset_catalogs.prf b/mkspecs/features/mac/asset_catalogs.prf index 57d93d56d5..87875136c2 100644 --- a/mkspecs/features/mac/asset_catalogs.prf +++ b/mkspecs/features/mac/asset_catalogs.prf @@ -65,7 +65,7 @@ actool_output_files = $$system(\ mkdir -p $$system_quote($$QMAKE_ASSET_CATALOGS_BUILD_PATH) && \ /usr/libexec/PlistBuddy -c \'Print :com.apple.actool.compilation-results:output-files\' \ - /dev/stdin <<< $($${asset_catalog_compiler.commands} 2>/dev/null) | grep \'^ .*$\', lines) + /dev/stdin <<< $($${asset_catalog_compiler.commands} 2>/dev/null) | sed -Ene \'s/^ +//p\', lines) for (output_file, actool_output_files) { !equals(output_file, $$asset_catalog_compiler.target): \ -- cgit v1.2.3 From d8857f21ac2640215177b9cb7bb681b74bc66068 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 22 Nov 2016 09:46:14 +0100 Subject: If there are no available sizes, then fallback to the requested size In a case like the SVG iconengine there is no available sizes implementation. However in that case we don't need to provide different sizes as we can have SVG scale it for us to the one requested. So it is assumed that with no available sizes implementation that the icon engine will take care of this for us. This ensures that SVG files can be used as icons inside the menu on macOS. Task-number: QTBUG-40225 Task-number: QTBUG-55932 Change-Id: If01ca582c4c07834e6de16652924e0b7e118c87c Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoahelpers.h | 2 +- src/plugins/platforms/cocoa/qcocoahelpers.mm | 7 +++++-- src/plugins/platforms/cocoa/qcocoamenuitem.mm | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index c2abe4e245..bbb37937d2 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -64,7 +64,7 @@ inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qst NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); NSImage *qt_mac_create_nsimage(const QPixmap &pm); -NSImage *qt_mac_create_nsimage(const QIcon &icon); +NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0); CGImageRef qt_mac_toCGImage(const QImage &qImage); CGImageRef qt_mac_toCGImageMask(const QImage &qImage); QImage qt_mac_toQImage(CGImageRef image); diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 058209da7e..cd73148752 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -152,13 +152,16 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm) return nsImage; } -NSImage *qt_mac_create_nsimage(const QIcon &icon) +NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize) { if (icon.isNull()) return nil; NSImage *nsImage = [[NSImage alloc] init]; - foreach (QSize size, icon.availableSizes()) { + QList availableSizes = icon.availableSizes(); + if (availableSizes.isEmpty() && defaultSize > 0) + availableSizes << QSize(defaultSize, defaultSize); + foreach (QSize size, availableSizes) { QPixmap pm = icon.pixmap(size); QImage image = pm.toImage(); CGImageRef cgImage = qt_mac_toCGImage(image); diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 2d4073956a..fa8eb22569 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -348,7 +348,7 @@ NSMenuItem *QCocoaMenuItem::sync() NSImage *img = nil; if (!m_icon.isNull()) { - img = qt_mac_create_nsimage(m_icon); + img = qt_mac_create_nsimage(m_icon, m_iconSize); [img setSize:NSMakeSize(m_iconSize, m_iconSize)]; } [m_native setImage:img]; -- cgit v1.2.3 From 389b4ec28b6bb402d3575ff9c648ef878257ea84 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 22 Nov 2016 15:45:36 +0100 Subject: Windows QPA: Do not send key events for mouse-synthesized app commands Sending key events in addition causes applications to respond twice to for example the back / forward extra mouse buttons. Suppress the keypress by checking on the device. This is in line with the other platforms, which do not send keypresses either. Native event filters will still be able to listen for WM_APPCOMMAND. Task-number: QTBUG-48117 Task-number: QTBUG-57198 Change-Id: I219e17244087663f06ab2c5a8cf4b880c3655700 Reviewed-by: Andy Shaw --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 60361e436d..a52ae7c2a9 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -861,6 +861,9 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd, bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, const MSG &msg) { #if defined(WM_APPCOMMAND) + // QTBUG-57198, do not send mouse-synthesized commands as key events in addition + if (GET_DEVICE_LPARAM(msg.lParam) == FAPPCOMMAND_MOUSE) + return false; const int cmd = GET_APPCOMMAND_LPARAM(msg.lParam); const int dwKeys = GET_KEYSTATE_LPARAM(msg.lParam); int state = 0; -- cgit v1.2.3 From 5b05c37845887c275c8b076505f536bc42edf099 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 19:40:33 +0100 Subject: qmake: fix up dist targets for mingw & nmake somewhat actually pack the extra compilers' input files, not the variable names. unlike on unix, we don't create an actual distdir, so the package is still going to be rather broken. Change-Id: If0a15bbe9db95aebd88c2a21ca3c0f787ce5c7e1 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/winmakefile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index ccf6457048..26e1901f8b 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -608,8 +608,10 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { const ProStringList &inputs = project->values(ProKey(*it + ".input")); - for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) - t << escapeFilePath(*input) << ' '; + for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) { + const ProStringList &val = project->values((*input).toKey()); + t << escapeFilePaths(val).join(' ') << ' '; + } } } t << endl << endl; -- cgit v1.2.3 From 0810d48bc4cb820c0cba982a2ec392058eccd466 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 19:05:54 +0100 Subject: unbreak "aux" template for mingw & msvc, take 2 of course, we should stub out everything related to TARGET - only the generic "all" and "first" targets including their deps should be emitted. amends af2847260. Change-Id: I8ed7a550b8022c69328d2e16dbd078928d176964 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/mingw_make.cpp | 9 +++++++-- qmake/generators/win32/msvc_nmake.cpp | 9 +++++++-- qmake/generators/win32/winmakefile.cpp | 18 ++++++++++-------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 8c315e0696..92c6f35817 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -313,7 +313,12 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + << ' ' << depVar("ALL_DEPS"); + if (project->first("TEMPLATE") == "aux") { + t << "\n\n"; + return; + } + t << " $(DESTDIR_TARGET)\n\n"; t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <first("TEMPLATE") != "aux") { + } else { t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)"; } if(!project->isEmpty("QMAKE_POST_LINK")) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 41bec4c36d..8f70be4665 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -552,7 +552,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + << ' ' << depVar("ALL_DEPS"); + if (templateName == "aux") { + t << "\n\n"; + return; + } + t << " $(DESTDIR_TARGET)\n\n"; t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) @@ -561,7 +566,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "\n\t$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<\n\t " << "$(OBJECTS)" << "\n<<"; - } else if (templateName != "aux") { + } else { const bool embedManifest = ((templateName == "app" && project->isActiveConfig("embed_manifest_exe")) || (templateName == "lib" && project->isActiveConfig("embed_manifest_dll") && !(project->isActiveConfig("plugin") && project->isActiveConfig("no_plugin_manifest")) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 26e1901f8b..ec66efd1cb 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -575,16 +575,18 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) t << "####### Build rules\n\n"; writeBuildRulesPart(t); - if(project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { - const ProStringList &dlldirs = project->values("DLLDESTDIR"); - for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { - t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " - << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; + if (project->first("TEMPLATE") != "aux") { + if (project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { + const ProStringList &dlldirs = project->values("DLLDESTDIR"); + for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { + t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " + << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; + } } - } - t << endl; + t << endl; - writeRcFilePart(t); + writeRcFilePart(t); + } writeMakeQmake(t); -- cgit v1.2.3 From 435e7b17a35f4aa2cc2a7cb3ac935cf56ee27d62 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 15 Nov 2016 17:28:44 +0100 Subject: Fix qmldir copying in debug and release builds on Windows This is a backport of 6cc02ce6c85d3dbd49a55060bd21a8359884786f from 5.7. In a parallel build we may end up copying the qmldir file at the same time, which doesn't work on Windows due to file locking. Apply the same guard for the copying condition as in commit 770a0c91f3fadcdb132d9eb96d085aafbe1bacd0. Task-number: QTBUG-57153 Change-Id: Ibac759b16cebaf04f5d2f785211b62071aa656a8 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qml_module.prf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index b09d42a0a4..47ebe78400 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -28,4 +28,8 @@ qmldir.files = $$fq_qml_files qmldir.path = $$instbase/$$TARGETPATH INSTALLS += qmldir -!prefix_build: COPIES += qmldir +!debug_and_release|!build_all|CONFIG(release, debug|release) { + !prefix_build { + COPIES += qmldir + } +} -- cgit v1.2.3 From d3ab4a1ce7cd0fe6539d592138a8119dd51d818f Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 16 Nov 2016 13:11:43 +0100 Subject: _q_networkSessionClosed - disconnect the correct object We have: ... auto networkSession = getNetworkSession(); ... getNetworkSession() can return non-null pointer even if networkSessionStrongRef is null: ... if (networkSessionStrongRef) return networkSessionStrongRef; return networkSessionWeakRef.toStrongRef(); .... We check the result: if (networkSession) { // here we disconnect signals } But we should use the same networkSession when disconnecting, not start using networkSessionStrongRef suddenly, since it can be null. Task-number: QTBUG-57110 Change-Id: I96babb42c2182e741e6eabaf7d1abb88869861f4 Reviewed-by: Jesus Fernandez Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkaccessmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b649aba4a8..57d110ed94 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1599,7 +1599,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed() QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)), q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); - QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)), + QObject::disconnect(networkSession.data(), SIGNAL(error(QNetworkSession::SessionError)), q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError))); networkSessionStrongRef.clear(); -- cgit v1.2.3 From a4bd635b33d08a4b58fb4db8cefd1e0535fb95eb Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 21 Nov 2016 17:05:49 +0100 Subject: Typo fix in QDateTime::toString() documentation Text that should simply have been naming days of the week used Qt::Sunday rather than the simple day name. Change-Id: I64a3cdacd854c1c9c0fbf2d11826555086d674f4 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 3e29b55666..5f5023e8b5 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3611,7 +3611,7 @@ QString QDateTime::toString(Qt::DateFormat format) const \li the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses the system locale to localize the name, i.e. QLocale::system(). \row \li dddd - \li the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). + \li the long localized day name (e.g. 'Monday' to 'Sunday'). Uses the system locale to localize the name, i.e. QLocale::system(). \row \li M \li the month as number without a leading zero (1-12) \row \li MM \li the month as number with a leading zero (01-12) -- cgit v1.2.3 From 0aa3de46cacacdb83efe1d5e5b2506560c93c9ff Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 7 Nov 2016 10:09:06 +0100 Subject: Fix two leaky uses of realloc() If it fails, we get NULL back but haven't free()d the old pointer; saving the NULL return over the old pointer forgets it, leaking the memory it pointed to. This is particularly severe in the JSON parser's grow(), where reading a very large JSON document can lead to the last successful realloc() in a doubling pattern being very large indeed; the subsequent failure will leak this very last allocation. Only worth checking for, however, when the subsequent code takes care to handle failure: in most cases, if realloc() fails, we're about to crash anyway. Change-Id: Icd3a503f169be224f0a058c58e8b7c82a3241ae7 Reviewed-by: Marc Mutz Reviewed-by: Anton Kudryavtsev --- src/corelib/json/qjsonparser.cpp | 5 +++-- src/corelib/json/qjsonparser_p.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index c7b16d5ec9..a23741a85c 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -491,9 +491,10 @@ namespace { memcpy(newValues, data, size*sizeof(QJsonPrivate::Value)); data = newValues; } else { - data = static_cast(realloc(data, alloc*sizeof(QJsonPrivate::Value))); - if (!data) + void *newValues = realloc(data, alloc * sizeof(QJsonPrivate::Value)); + if (!newValues) return false; + data = static_cast(newValues); } return true; } diff --git a/src/corelib/json/qjsonparser_p.h b/src/corelib/json/qjsonparser_p.h index 82a7899a51..b17d75fb3a 100644 --- a/src/corelib/json/qjsonparser_p.h +++ b/src/corelib/json/qjsonparser_p.h @@ -101,11 +101,12 @@ private: inline int reserveSpace(int space) { if (current + space >= dataLength) { dataLength = 2*dataLength + space; - data = (char *)realloc(data, dataLength); - if (!data) { + char *newData = (char *)realloc(data, dataLength); + if (!newData) { lastError = QJsonParseError::DocumentTooLarge; return -1; } + data = newData; } int pos = current; current += space; -- cgit v1.2.3 From 7c41ced98c3cb5484069c14c45733d3129e7945a Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 2 Feb 2016 17:35:09 +0100 Subject: QDateTimeParser: introduce at least some encapsulation Shuffled its parts to make clear which bits are public, private and protected. QDateTimeEditPrivate makes rather heavy use of the last. Change-Id: Ic5f9d0c5cc85f02e57d3f31e9ac31a17428c5311 Reviewed-by: Timur Pocheptsov --- src/corelib/tools/qdatetimeparser_p.h | 81 ++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index 90c6a8acba..0ac7532aed 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -97,14 +97,6 @@ public: none.zeroesAdded = 0; } virtual ~QDateTimeParser() {} - enum AmPmFinder { - Neither = -1, - AM = 0, - PM = 1, - PossibleAM = 2, - PossiblePM = 3, - PossibleBoth = 4 - }; enum Section { NoSection = 0x00000, @@ -180,62 +172,75 @@ public: #ifndef QT_NO_DATESTRING StateNode parse(QString &input, int &cursorPosition, const QDateTime ¤tValue, bool fixup) const; #endif - int sectionMaxSize(int index) const; - int sectionSize(int index) const; - int sectionMaxSize(Section s, int count) const; - int sectionPos(int index) const; - int sectionPos(const SectionNode &sn) const; - - const SectionNode §ionNode(int index) const; - Section sectionType(int index) const; - QString sectionText(int sectionIndex) const; - QString sectionText(const QString &text, int sectionIndex, int index) const; - int getDigit(const QDateTime &dt, int index) const; - bool setDigit(QDateTime &t, int index, int newval) const; - int parseSection(const QDateTime ¤tValue, int sectionIndex, QString &txt, int &cursorPosition, - int index, QDateTimeParser::State &state, int *used = 0) const; - int absoluteMax(int index, const QDateTime &value = QDateTime()) const; - int absoluteMin(int index) const; bool parseFormat(const QString &format); #ifndef QT_NO_DATESTRING bool fromString(const QString &text, QDate *date, QTime *time) const; #endif + enum FieldInfoFlag { + Numeric = 0x01, + FixedWidth = 0x02, + AllowPartial = 0x04, + Fraction = 0x08 + }; + Q_DECLARE_FLAGS(FieldInfo, FieldInfoFlag) + + FieldInfo fieldInfo(int index) const; + + void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; } + virtual QString displayText() const { return text; } + +private: + int sectionMaxSize(Section s, int count) const; + QString sectionText(const QString &text, int sectionIndex, int index) const; + int parseSection(const QDateTime ¤tValue, int sectionIndex, QString &txt, int &cursorPosition, + int index, QDateTimeParser::State &state, int *used = 0) const; #ifndef QT_NO_TEXTDATE int findMonth(const QString &str1, int monthstart, int sectionIndex, QString *monthName = 0, int *used = 0) const; int findDay(const QString &str1, int intDaystart, int sectionIndex, QString *dayName = 0, int *used = 0) const; #endif + + enum AmPmFinder { + Neither = -1, + AM = 0, + PM = 1, + PossibleAM = 2, + PossiblePM = 3, + PossibleBoth = 4 + }; AmPmFinder findAmPm(QString &str, int index, int *used = 0) const; bool potentialValue(const QString &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const; - bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const; - QString stateName(State s) const; +protected: // for the benefit of QDateTimeEditPrivate + int sectionSize(int index) const; + int sectionMaxSize(int index) const; + int sectionPos(int index) const; + int sectionPos(const SectionNode &sn) const; - enum FieldInfoFlag { - Numeric = 0x01, - FixedWidth = 0x02, - AllowPartial = 0x04, - Fraction = 0x08 - }; - Q_DECLARE_FLAGS(FieldInfo, FieldInfoFlag) + const SectionNode §ionNode(int index) const; + Section sectionType(int index) const; + QString sectionText(int sectionIndex) const; + int getDigit(const QDateTime &dt, int index) const; + bool setDigit(QDateTime &t, int index, int newval) const; - FieldInfo fieldInfo(int index) const; + int absoluteMax(int index, const QDateTime &value = QDateTime()) const; + int absoluteMin(int index) const; - void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; } + bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const; + QString stateName(State s) const; virtual QDateTime getMinimum() const; virtual QDateTime getMaximum() const; virtual int cursorPosition() const { return -1; } - virtual QString displayText() const { return text; } virtual QString getAmPmText(AmPm ap, Case cs) const; virtual QLocale locale() const { return defaultLocale; } mutable int currentSectionIndex; Sections display; /* - This stores the stores the most recently selected day. + This stores the most recently selected day. It is useful when considering the following scenario: 1. Date is: 31/01/2000 @@ -255,9 +260,7 @@ public: QString displayFormat; QLocale defaultLocale; QVariant::Type parserType; - bool fixday; - Qt::TimeSpec spec; // spec if used by QDateTimeEdit Context context; }; -- cgit v1.2.3 From 4f896ba34e0f56e492da19c6d1353ac4ba4c7b2e Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Wed, 23 Nov 2016 11:39:31 +0100 Subject: ICC: Fix MySQL driver build In function `QMYSQLDriver::formatValue(QSqlField const&, bool) const': qsql_mysql.cpp:1569: undefined reference to `QString::operator=( QLatin1String) Change-Id: I56104cdd53fdc083670510f24b735cf05948f156 Reviewed-by: Samuel Gaist Reviewed-by: Milian Wolff Reviewed-by: Thiago Macieira --- src/sql/drivers/mysql/qsql_mysql.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index c26c03ad07..4e86a0bd4e 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -1566,7 +1566,7 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons Q_D(const QMYSQLDriver); QString r; if (field.isNull()) { - r = QLatin1String("NULL"); + r = QStringLiteral("NULL"); } else { switch(field.type()) { case QVariant::Double: -- cgit v1.2.3 From 5bd2d6afec935a9eb4cf39af830f450f89f7202a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 24 Nov 2016 10:54:03 +0200 Subject: Remove nokia reference in example mimetype Change-Id: I45c01fd57171f4ba6ea195d7ad3ae988a1797acb Reviewed-by: Oswald Buddenhagen Reviewed-by: David Faure --- src/corelib/mimetypes/qmimedatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index 5c272d420b..91b50494d0 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -257,7 +257,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent) \code - + Qt qmake Profile -- cgit v1.2.3 From 17d72c783747dd8d9ce767002988d5d5a54a790e Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sat, 19 Nov 2016 08:55:33 +0200 Subject: Android: All gcc flags should be set for clang too gcc-base-unix.conf must be included before clang.conf because clang.conf doesn't set all the needed flags. Change-Id: I71f95732d0d245096b575c91610800d91c6aa5d7 Reviewed-by: Vyacheslav Koscheev Reviewed-by: Oswald Buddenhagen --- mkspecs/android-clang/qmake.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf index c33bbe7eed..3e621c7d77 100644 --- a/mkspecs/android-clang/qmake.conf +++ b/mkspecs/android-clang/qmake.conf @@ -6,6 +6,7 @@ QMAKE_COMPILER = gcc clang llvm CONFIG += android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings include(../common/linux.conf) +include(../common/gcc-base-unix.conf) include(../common/clang.conf) include(../common/android-base-head.conf) -- cgit v1.2.3