From cdc5f47aeba94ba083a81dc681a09a351809e528 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 Apr 2017 21:11:12 -0700 Subject: Restore compatibility with Qt 5.7.0 and 5.6.1 QSysInfo::productType() returned "osx" for all versions of macOS, even 10.12. Change 3e2bde35786 was incorrect. [ChangeLog][Important Behavior Changes] QSysInfo::productType() and QFileSelector behavior on macOS was restored to match what Qt used to return in version 5.7.0 and earlier. The behavior found in Qt 5.6.2, 5.7.1 and 5.8.0 is removed. [ChangeLog][Future Compatibility Notice] The identifiers that QSysInfo::productType() and QFileSelector will use to identify macOS systems will change in Qt 6.0 to match the Apple naming guidelines which will be current then. Task-number: QTBUG-59849 Change-Id: Ib0e40a7a3ebc44329f23fffd14b2b39392210c4f Reviewed-by: Jake Petroules --- tests/auto/corelib/io/qfileselector/platforms/+mac/test2 | 0 tests/auto/corelib/io/qfileselector/platforms/+mac/test5 | 0 tests/auto/corelib/io/qfileselector/platforms/+macos/test | 0 tests/auto/corelib/io/qfileselector/platforms/+macos/test2 | 0 tests/auto/corelib/io/qfileselector/platforms/+osx/test2 | 0 tests/auto/corelib/io/qfileselector/platforms/+osx/test4 | 0 .../io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test | 0 .../platforms/+unix/+darwin/+mac/+osx/+macos/test | 0 tests/auto/corelib/io/qfileselector/platforms/test4 | 0 tests/auto/corelib/io/qfileselector/platforms/test5 | 0 tests/auto/corelib/io/qfileselector/qfileselector.qrc | 10 +++++++++- tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp | 8 ++++++++ 12 files changed, 17 insertions(+), 1 deletion(-) delete mode 100644 tests/auto/corelib/io/qfileselector/platforms/+mac/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+mac/test5 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+macos/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+macos/test2 delete mode 100644 tests/auto/corelib/io/qfileselector/platforms/+osx/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+osx/test4 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/test4 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/test5 (limited to 'tests') diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test2 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test2 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+macos/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+macos/test2 b/tests/auto/corelib/io/qfileselector/platforms/+macos/test2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test2 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test2 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/test4 b/tests/auto/corelib/io/qfileselector/platforms/test4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/test5 b/tests/auto/corelib/io/qfileselector/platforms/test5 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc index ab7a4d7f23..ea9b8270e0 100644 --- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc +++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc @@ -15,6 +15,7 @@ platforms/test platforms/+unix/+android/test platforms/+unix/+darwin/+mac/+ios/test + platforms/+unix/+darwin/+mac/+osx/+macos/test platforms/+unix/+darwin/+mac/+osx/test platforms/+unix/+darwin/+mac/test platforms/+unix/+darwin/test @@ -27,6 +28,7 @@ platforms/+windows/test platforms/+android/test platforms/+ios/test + platforms/+macos/test platforms/+osx/test platforms/+darwin/test platforms/+mac/test @@ -39,7 +41,7 @@ platforms/test2 platforms/+android/test2 platforms/+ios/test2 - platforms/+osx/test2 + platforms/+macos/test2 platforms/+haiku/test2 platforms/+linux/test2 platforms/+wince/test2 @@ -50,5 +52,11 @@ platforms/test3 platforms/+windows/test3 platforms/+unix/test3 + + + platforms/test4 + platforms/+osx/test4 + platforms/test5 + platforms/+mac/test5 diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index e5ede1ad06..f2d09429cc 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -126,6 +126,14 @@ void tst_QFileSelector::basicTest_data() QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList() << expectedPlatform3File; +#ifdef Q_OS_MACOS + // special case for compatibility code + QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList() + << ":/platforms/+osx/test4"; + QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList() + << ":/platforms/+mac/test5"; +#endif + QString resourceTestPath(":/extras/test"); QString custom1("custom1"); QTest::newRow("custom1-noselector") << resourceTestPath << QStringList() -- cgit v1.2.3 From 5662234afaf23d88e1f3fa4bee2a59b61bd0c267 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 14 Apr 2017 12:39:20 +0200 Subject: QMatrix4x4: fix aliasing problem in operator*= When multiplying a QMatrix4x4 by itself, we were clobbering the very matrix we read from. Employ read-caching to avoid this aliasing problem. [ChangeLog][QtGui][QMatrix4x4] operator*=() now calculates the correct result even if the RHS and LHS are the same object. Change-Id: I8534d56cfdd62c336577125127f05173fcec2873 Reviewed-by: Sean Harmer --- tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index aea97a916e..c2c04b69c5 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -1227,6 +1227,10 @@ void tst_QMatrixNxN::multiply4x4() QMatrix4x4 m5; m5 = m1 * m2; QVERIFY(isSame(m5, (const float *)m3Values)); + + QMatrix4x4 m1xm1 = m1 * m1; + m1 *= m1; + QCOMPARE(m1, m1xm1); } // Test matrix multiplication for 4x3 matrices. -- cgit v1.2.3 From d1210281e41008ce2e3510aa5cfb3ebea1c57734 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Mon, 17 Apr 2017 00:35:38 +0300 Subject: Fix undefined behavior in QSharedPointer::create() Initialize a deleter for a new object, created by QSharedPointer::create(), only after the object is actually constructed. [ChangeLog][QtCore][QSharedPointer] Fixed undefined behavior when creating an object with QSharedPointer::create() and its conscructor throws an exception. Task-number: QTBUG-49824 Change-Id: I07f77a78ff468d9b45b8ef133278e8cdd96a0647 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../tools/qsharedpointer/tst_qsharedpointer.cpp | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index d0a0feb125..7850478602 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -97,6 +97,8 @@ private slots: void qvariantCast(); void sharedFromThis(); + void constructorThrow(); + void threadStressTest_data(); void threadStressTest(); void validConstructs(); @@ -2594,6 +2596,54 @@ void tst_QSharedPointer::sharedFromThis() QCOMPARE(Data::destructorCounter, destructions + 6); } +#ifndef QT_NO_EXCEPTIONS +class ThrowData: public Data +{ +public: + static int childDestructorCounter; + static int childGenerationCounter; + + ThrowData() + { + childGenerationCounter++; + throw QStringLiteral("Dummy exception"); + } + + ~ThrowData() + { + childDestructorCounter++; + } +}; +int ThrowData::childDestructorCounter = 0; +int ThrowData::childGenerationCounter = 0; +#endif // !QT_NO_EXCEPTIONS + +void tst_QSharedPointer::constructorThrow() +{ +#ifndef QT_NO_EXCEPTIONS + int generation = Data::generationCounter; + int destructorCounter = Data::destructorCounter; + + int childGeneration = ThrowData::childGenerationCounter; + int childDestructorCounter = ThrowData::childDestructorCounter; + + QSharedPointer ptr; + QVERIFY_EXCEPTION_THROWN(ptr = QSharedPointer::create(), QString); + QVERIFY(ptr.isNull()); + QCOMPARE(ThrowData::childGenerationCounter, childGeneration + 1); + // destructor should never be called, if a constructor throws + // an exception + QCOMPARE(ThrowData::childDestructorCounter, childDestructorCounter); + + QCOMPARE(Data::generationCounter, generation + 1); + // but base class constructor doesn't throw, so base class destructor + // should be called + QCOMPARE(Data::destructorCounter, destructorCounter + 1); +#else + QSKIP("Needs exceptions"); +#endif // !QT_NO_EXCEPTIONS +} + namespace ReentrancyWhileDestructing { struct IB { -- cgit v1.2.3