From 1823c8f2ddd0a5c1b4301e7af7109796090a3c9a Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 16 Dec 2015 14:04:27 +0100 Subject: Fix utf8->utf16 BOM/ZWNBSP decoding. When the byte sequence for a BOM occurs in the middle of a utf8 stream, it is a ZWNBSP. When a ZWNBSP occurs in the middle of a utf8 character sequence, and the SIMD conversion does some work (meaning: the length is at least 16 characters long), it would not recognize the fact some charactes were already decoded. So the conversion would then strip the ZWNBSP out, thinking it's a BOM. The non-SIMD conversion did not have this problem: the very first character conversion would already set the headerdone flag. Change-Id: I39aacf607e2e068107106254021a8042d164f628 Reviewed-by: Thiago Macieira --- tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index 3aa06d237d..8a9ae0cd72 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -1588,10 +1588,17 @@ void tst_QTextCodec::utf8bom_data() << QString("a"); } - { + { // test the non-SIMD code-path static const ushort data[] = { 0x61, 0xfeff, 0x62 }; - QTest::newRow("middle-bom") - << QByteArray("a\357\273\277b", 5) + QTest::newRow("middle-bom (non SIMD)") + << QByteArray("a\357\273\277b") + << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + } + + { // test the SIMD code-path + static const ushort data[] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xfeff, 0x6d }; + QTest::newRow("middle-bom (SIMD)") + << QByteArray("abcdefghijkl\357\273\277m") << QString::fromUtf16(data, sizeof(data)/sizeof(short)); } } -- cgit v1.2.3 From e0a5f661e52fd09611f406ae82128b6ef81fe90e Mon Sep 17 00:00:00 2001 From: Masaru Ueki Date: Sat, 26 Dec 2015 16:01:25 +0900 Subject: QStateMachine: fix ignore high-priority events. When a high-priority event is posted in overrided 'QStateMachine::beginSelectTransitions', the event may be remained in event queue, and be not dispatched until another event posted. Change-Id: Ifda288d9c00ac7985e426b9cc02bda382ebaac35 Reviewed-by: Erik Verbruggen --- .../qstatemachine/tst_qstatemachine.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index 1292c3b98f..e60b1c983c 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -250,6 +250,7 @@ private slots: void internalTransition(); void conflictingTransition(); void qtbug_46059(); + void postEventFromBeginSelectTransitions(); }; class TestState : public QState @@ -6485,5 +6486,33 @@ void tst_QStateMachine::qtbug_46059() QVERIFY(machine.isRunning()); } +void tst_QStateMachine::postEventFromBeginSelectTransitions() +{ + class StateMachine : public QStateMachine { + protected: + void beginSelectTransitions(QEvent* e) Q_DECL_OVERRIDE { + if (e->type() == QEvent::Type(QEvent::User + 2)) + postEvent(new QEvent(QEvent::Type(QEvent::User + 1)), QStateMachine::HighPriority); + } + } machine; + QState a(&machine); + QState success(&machine); + + machine.setInitialState(&a); + a.addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), &success)); + + machine.start(); + + QTRY_COMPARE(machine.configuration().contains(&a), true); + QTRY_COMPARE(machine.configuration().contains(&success), false); + + machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 2)), QStateMachine::NormalPriority); + + QTRY_COMPARE(machine.configuration().contains(&a), false); + QTRY_COMPARE(machine.configuration().contains(&success), true); + + QVERIFY(machine.isRunning()); +} + QTEST_MAIN(tst_QStateMachine) #include "tst_qstatemachine.moc" -- cgit v1.2.3 From 033205bb598fe49e6ca4c90fb4e046e996c20252 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Jan 2016 12:51:02 +0100 Subject: Fix UB in tst_QIODevice::getSetCheck() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reinterpret cast from a QTcpSocket → QAbstractSocket → QIODevice to MyIODevice → QIODevice was undefined. Fix by simply instantiating a MyIODevice, which must then inherit from QTcpSocket, of course. Instead of fixing the class name in the overridden setOpenMode() method, simply make the base class' implementation public with a using declaration. Found by UBSan: qtbase/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp:84:22: runtime error: member call on address 0x7ffcca2d23f0 which does not point to an object of type 'MyIODevice' 0x7ffcca2d23f0: note: object is of type 'QTcpSocket' Change-Id: I939b3548949b9b5765df4a6cc81875e169fd69dd Reviewed-by: Alex Trotsenko Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 565ca18899..af79de06d5 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -74,16 +74,15 @@ void tst_QIODevice::getSetCheck() { // OpenMode QIODevice::openMode() // void QIODevice::setOpenMode(OpenMode) - class MyIODevice : public QIODevice { + class MyIODevice : public QTcpSocket { public: - void setOpenMode(OpenMode openMode) { QIODevice::setOpenMode(openMode); } + using QTcpSocket::setOpenMode; }; - QTcpSocket var1; - MyIODevice *obj1 = reinterpret_cast(&var1); - obj1->setOpenMode(QIODevice::OpenMode(QIODevice::NotOpen)); - QCOMPARE(QIODevice::OpenMode(QIODevice::NotOpen), obj1->openMode()); - obj1->setOpenMode(QIODevice::OpenMode(QIODevice::ReadWrite)); - QCOMPARE(QIODevice::OpenMode(QIODevice::ReadWrite), obj1->openMode()); + MyIODevice var1; + var1.setOpenMode(QIODevice::OpenMode(QIODevice::NotOpen)); + QCOMPARE(QIODevice::OpenMode(QIODevice::NotOpen), var1.openMode()); + var1.setOpenMode(QIODevice::OpenMode(QIODevice::ReadWrite)); + QCOMPARE(QIODevice::OpenMode(QIODevice::ReadWrite), var1.openMode()); } //---------------------------------------------------------------------------------- -- cgit v1.2.3 From bccbb70de548c5defcb2ab58a987ef2e966788bc Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Jan 2016 16:56:26 +0100 Subject: Fix UB in tst_QMetaType Don't pass around meta-type IDs in QMetaType::Type variables. It leads to reading values from an enum variable that are invalid. Fix by passing the IDs around as int. Found by UBSan: tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:408:5: runtime error: load of value 4028, which is not a valid value for type 'Type' Change-Id: Idd106ee3d7960fe3d8fefc0fc5830fc22d38a513 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../corelib/kernel/qmetatype/tst_qmetatype.cpp | 86 +++++++++++----------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 9cdb1f47f8..a4bfc8ac9b 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -369,40 +369,40 @@ void tst_QMetaType::normalizedTypes() } #define TYPENAME_DATA(MetaTypeName, MetaTypeId, RealType)\ - QTest::newRow(#RealType) << QMetaType::MetaTypeName << #RealType; + QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << #RealType; void tst_QMetaType::typeName_data() { - QTest::addColumn("aType"); + QTest::addColumn("aType"); QTest::addColumn("aTypeName"); QT_FOR_EACH_STATIC_TYPE(TYPENAME_DATA) - QTest::newRow("QMetaType::UnknownType") << QMetaType::UnknownType << static_cast(0); + QTest::newRow("QMetaType::UnknownType") << int(QMetaType::UnknownType) << static_cast(0); - QTest::newRow("Whity") << static_cast(::qMetaTypeId >()) << QString::fromLatin1("Whity"); - QTest::newRow("Whity") << static_cast(::qMetaTypeId >()) << QString::fromLatin1("Whity"); - QTest::newRow("Testspace::Foo") << static_cast(::qMetaTypeId()) << QString::fromLatin1("TestSpace::Foo"); + QTest::newRow("Whity") << ::qMetaTypeId >() << QString::fromLatin1("Whity"); + QTest::newRow("Whity") << ::qMetaTypeId >() << QString::fromLatin1("Whity"); + QTest::newRow("Testspace::Foo") << ::qMetaTypeId() << QString::fromLatin1("TestSpace::Foo"); - QTest::newRow("-1") << QMetaType::Type(-1) << QString(); - QTest::newRow("-124125534") << QMetaType::Type(-124125534) << QString(); - QTest::newRow("124125534") << QMetaType::Type(124125534) << QString(); + QTest::newRow("-1") << -1 << QString(); + QTest::newRow("-124125534") << -124125534 << QString(); + QTest::newRow("124125534") << 124125534 << QString(); // automatic registration - QTest::newRow("QList") << static_cast(::qMetaTypeId >()) << QString::fromLatin1("QList"); - QTest::newRow("QHash") << static_cast(::qMetaTypeId >()) << QString::fromLatin1("QHash"); - QTest::newRow("QMap") << static_cast(::qMetaTypeId >()) << QString::fromLatin1("QMap"); - QTest::newRow("QVector>") << static_cast(::qMetaTypeId > >()) << QString::fromLatin1("QVector >"); - QTest::newRow("QVector>") << static_cast(::qMetaTypeId > >()) << QString::fromLatin1("QVector >"); + QTest::newRow("QList") << ::qMetaTypeId >() << QString::fromLatin1("QList"); + QTest::newRow("QHash") << ::qMetaTypeId >() << QString::fromLatin1("QHash"); + QTest::newRow("QMap") << ::qMetaTypeId >() << QString::fromLatin1("QMap"); + QTest::newRow("QVector>") << ::qMetaTypeId > >() << QString::fromLatin1("QVector >"); + QTest::newRow("QVector>") << ::qMetaTypeId > >() << QString::fromLatin1("QVector >"); - QTest::newRow("CustomQObject*") << static_cast(::qMetaTypeId()) << QString::fromLatin1("CustomQObject*"); - QTest::newRow("CustomGadget") << static_cast(::qMetaTypeId()) << QString::fromLatin1("CustomGadget"); - QTest::newRow("CustomQObject::CustomQEnum") << static_cast(::qMetaTypeId()) << QString::fromLatin1("CustomQObject::CustomQEnum"); - QTest::newRow("Qt::ArrowType") << static_cast(::qMetaTypeId()) << QString::fromLatin1("Qt::ArrowType"); + QTest::newRow("CustomQObject*") << ::qMetaTypeId() << QString::fromLatin1("CustomQObject*"); + QTest::newRow("CustomGadget") << ::qMetaTypeId() << QString::fromLatin1("CustomGadget"); + QTest::newRow("CustomQObject::CustomQEnum") << ::qMetaTypeId() << QString::fromLatin1("CustomQObject::CustomQEnum"); + QTest::newRow("Qt::ArrowType") << ::qMetaTypeId() << QString::fromLatin1("Qt::ArrowType"); } void tst_QMetaType::typeName() { - QFETCH(QMetaType::Type, aType); + QFETCH(int, aType); QFETCH(QString, aTypeName); QString name = QString::fromLatin1(QMetaType::typeName(aType)); @@ -413,15 +413,15 @@ void tst_QMetaType::typeName() void tst_QMetaType::type_data() { - QTest::addColumn("aType"); + QTest::addColumn("aType"); QTest::addColumn("aTypeName"); #define TST_QMETATYPE_TYPE_DATA(MetaTypeName, MetaTypeId, RealType)\ - QTest::newRow(#RealType) << QMetaType::MetaTypeName << QByteArray( #RealType ); + QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << QByteArray( #RealType ); #define TST_QMETATYPE_TYPE_DATA_ALIAS(MetaTypeName, MetaTypeId, AliasType, RealTypeString)\ - QTest::newRow(RealTypeString) << QMetaType::MetaTypeName << QByteArray( #AliasType ); + QTest::newRow(RealTypeString) << int(QMetaType::MetaTypeName) << QByteArray( #AliasType ); - QTest::newRow("empty") << QMetaType::UnknownType << QByteArray(); + QTest::newRow("empty") << int(QMetaType::UnknownType) << QByteArray(); QT_FOR_EACH_STATIC_TYPE(TST_QMETATYPE_TYPE_DATA) QT_FOR_EACH_STATIC_ALIAS_TYPE(TST_QMETATYPE_TYPE_DATA_ALIAS) @@ -432,13 +432,13 @@ void tst_QMetaType::type_data() void tst_QMetaType::type() { - QFETCH(QMetaType::Type, aType); + QFETCH(int, aType); QFETCH(QByteArray, aTypeName); // QMetaType::type(QByteArray) - QCOMPARE(QMetaType::type(aTypeName), int(aType)); + QCOMPARE(QMetaType::type(aTypeName), aType); // QMetaType::type(const char *) - QCOMPARE(QMetaType::type(aTypeName.constData()), int(aType)); + QCOMPARE(QMetaType::type(aTypeName.constData()), aType); } void tst_QMetaType::type_fromSubString_data() @@ -727,9 +727,9 @@ template<> struct TestValueFactory { void tst_QMetaType::create_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); #define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \ - QTest::newRow(QMetaType::typeName(QMetaType::MetaTypeName)) << QMetaType::MetaTypeName; + QTest::newRow(QMetaType::typeName(QMetaType::MetaTypeName)) << int(QMetaType::MetaTypeName); FOR_EACH_CORE_METATYPE(ADD_METATYPE_TEST_ROW) #undef ADD_METATYPE_TEST_ROW } @@ -781,7 +781,7 @@ FOR_EACH_CORE_METATYPE(RETURN_CREATE_FUNCTION) } }; - QFETCH(QMetaType::Type, type); + QFETCH(int, type); TypeTestFunctionGetter::get(type)(); } @@ -832,33 +832,33 @@ FOR_EACH_CORE_METATYPE(RETURN_CREATE_COPY_FUNCTION) } }; - QFETCH(QMetaType::Type, type); + QFETCH(int, type); TypeTestFunctionGetter::get(type)(); } void tst_QMetaType::sizeOf_data() { - QTest::addColumn("type"); + QTest::addColumn("type"); QTest::addColumn("size"); - QTest::newRow("QMetaType::UnknownType") << QMetaType::UnknownType << size_t(0); + QTest::newRow("QMetaType::UnknownType") << int(QMetaType::UnknownType) << size_t(0); #define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \ - QTest::newRow(#RealType) << QMetaType::MetaTypeName << size_t(QTypeInfo::sizeOf); + QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << size_t(QTypeInfo::sizeOf); FOR_EACH_CORE_METATYPE(ADD_METATYPE_TEST_ROW) #undef ADD_METATYPE_TEST_ROW - QTest::newRow("Whity") << static_cast(::qMetaTypeId >()) << sizeof(Whity); -QTest::newRow("Whity") << static_cast(::qMetaTypeId >()) << sizeof(Whity); - QTest::newRow("Testspace::Foo") << static_cast(::qMetaTypeId()) << sizeof(TestSpace::Foo); + QTest::newRow("Whity") << ::qMetaTypeId >() << sizeof(Whity); + QTest::newRow("Whity") << ::qMetaTypeId >() << sizeof(Whity); + QTest::newRow("Testspace::Foo") << ::qMetaTypeId() << sizeof(TestSpace::Foo); - QTest::newRow("-1") << QMetaType::Type(-1) << size_t(0); - QTest::newRow("-124125534") << QMetaType::Type(-124125534) << size_t(0); - QTest::newRow("124125534") << QMetaType::Type(124125534) << size_t(0); + QTest::newRow("-1") << -1 << size_t(0); + QTest::newRow("-124125534") << -124125534 << size_t(0); + QTest::newRow("124125534") << 124125534 << size_t(0); } void tst_QMetaType::sizeOf() { - QFETCH(QMetaType::Type, type); + QFETCH(int, type); QFETCH(size_t, size); QCOMPARE(size_t(QMetaType::sizeOf(type)), size); } @@ -870,7 +870,7 @@ void tst_QMetaType::sizeOfStaticLess_data() void tst_QMetaType::sizeOfStaticLess() { - QFETCH(QMetaType::Type, type); + QFETCH(int, type); QFETCH(size_t, size); QCOMPARE(size_t(QMetaType(type).sizeOf()), size); } @@ -1126,7 +1126,7 @@ FOR_EACH_CORE_METATYPE(RETURN_CONSTRUCT_FUNCTION) } }; - QFETCH(QMetaType::Type, type); + QFETCH(int, type); TypeTestFunctionGetter::get(type)(); } @@ -1194,7 +1194,7 @@ FOR_EACH_CORE_METATYPE(RETURN_CONSTRUCT_COPY_FUNCTION) } }; - QFETCH(QMetaType::Type, type); + QFETCH(int, type); TypeTestFunctionGetter::get(type)(); } -- cgit v1.2.3 From f5291bf8b4f74e7dcaa4911594fae8c929e28229 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Jan 2016 17:46:11 +0100 Subject: Fix UB in tst_QObject::noDeclarativeParentChangedOnDestruction() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If QObjectPrivate::declarativeData is set, it is in various places in Qt expected to point to a QAbstractDeclarativeDataImpl, from which ownedByQml1 is unconditionally read. In noDeclarativeParentChangedOnDestruction(), the declarativeData pointer is, however, set to a local QAbstractDeclarativeData instance, which, being an empty class, has size 1 and alignment 1. Depending on the compiler's idea of bit field order, this code either read uninitialized data from the dummy object, or else some random stack memory outside any (valid) object. What caught UBSan's attention, though, was the difference in alignment between the two classes: src/corelib/kernel/qobject.cpp:917:9: runtime error: member access within misaligned address 0x7fffc9cf706f for type 'struct QAbstractDeclarativeDataImpl', which requires 4 byte alignment Fix by providing a properly initialized object of the correct type. Change-Id: Iae83a949ee5a7bc98df13e35ea614c063085fa13 Reviewed-by: Lars Knoll Reviewed-by: Jędrzej Nowacki Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 4617ce5e74..aa6ab31065 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -6396,7 +6396,8 @@ void tst_QObject::noDeclarativeParentChangedOnDestruction() QObject *parent = new QObject; QObject *child = new QObject; - QAbstractDeclarativeData dummy; + QAbstractDeclarativeDataImpl dummy; + dummy.ownedByQml1 = false; QObjectPrivate::get(child)->declarativeData = &dummy; parentChangeCalled = false; -- cgit v1.2.3 From c38b14e2519a2bdbd835e52ee699ae9ac3f45d00 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Jan 2016 23:17:03 +0100 Subject: Fix UB in tst_QSharedPointer::basics() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Binding a reference to the nullptr is undefined behavior. Just skip that particular test when 'ptr' is null. Found by UBSan: tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp:258:32: runtime error: reference binding to null pointer of type 'struct Data' Change-Id: I125588b9d269a6f76716d660d03142f409513885 Reviewed-by: Jędrzej Nowacki Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 7741803224..7538eaf378 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -246,8 +246,10 @@ void tst_QSharedPointer::basics() QCOMPARE(ptr.data(), aData); QCOMPARE(ptr.operator->(), aData); - Data &dataReference = *ptr; - QCOMPARE(&dataReference, aData); + if (!isNull) { + Data &dataReference = *ptr; + QCOMPARE(&dataReference, aData); + } QVERIFY(ptr == aData); QVERIFY(!(ptr != aData)); -- cgit v1.2.3 From 1e2b42523f3a04fc3403ef6864bbcba447e4362c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Jan 2016 17:46:11 +0100 Subject: Fix UB in tst_QObject::disconnectDoesNotLeakFunctor() If CountedStruct is passed a GetSenderObject object, it will attempt to call a member on it from within its own destructor. That works usually quite well, but in this test case, which tests for function object leaks when a connection is torn down because the sender object is destroyed, the destruction of the CountedStruct happens when all connections are severed in ~QObject. At that point, what used to be a GetSenderObject instance no longer is one and the call into one of its member functions invokes undefined behavior. Fix by making QObject::sender() public by a using declaration instead of a wrapper function. Found by UBSan: tests/auto/corelib/kernel/qobject/tst_qobject.cpp:6007:104: runtime error: member call on address 0x7ffc6e7538b0 which does not point to an object of type 'GetSenderObject' 0x7ffc6e7538b0: note: object is of type 'QObject' Change-Id: Ia973140037b3c1b5a670a8a3949d09b956f40349 Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index aa6ab31065..5b1dad78cf 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -5987,7 +5987,7 @@ class GetSenderObject : public QObject { Q_OBJECT public: - QObject *accessSender() { return sender(); } + using QObject::sender; // make public public Q_SLOTS: void triggerSignal() { Q_EMIT aSignal(); } @@ -6003,8 +6003,8 @@ struct CountedStruct CountedStruct(GetSenderObject *sender) : sender(sender) { ++countedStructObjectsCount; } CountedStruct(const CountedStruct &o) : sender(o.sender) { ++countedStructObjectsCount; } CountedStruct &operator=(const CountedStruct &) { return *this; } - // accessSender here allows us to check if there's a deadlock - ~CountedStruct() { --countedStructObjectsCount; if (sender != Q_NULLPTR) (void)sender->accessSender(); } + // calling sender() here allows us to check if there's a deadlock + ~CountedStruct() { --countedStructObjectsCount; if (sender) (void)sender->sender(); } void operator()() const { } GetSenderObject *sender; -- cgit v1.2.3