aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-12-15 13:53:55 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-12-18 12:02:39 +0000
commit4fff2bb14e55484eacec0a1b49a2b02958f75eca (patch)
treeb74e62d18d450c1fc237d6733224c7ddc2c7f131 /tests/benchmarks
parent61fd2b3d2a8b838e55d6560050ddf5ba7de3cee5 (diff)
Fix QQml_setParent_noEvent not to print undefined behavior errors
When building Qt with -fsanitize undefined, the usage of QQml_setParent_noEvent caused the following error message: "qqmlglobal_p.h:233:5: runtime error: downcast of address 0x60300061bf10 which does not point to an object of type 'QQmlGraphics_DerivedObject'". Instead of casting to the referred type, use QObjectPrivate::get to access the d_ptr. Change-Id: I2f2224bdb20a8d2e35a3291961378231f03c4ba2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp
index 91f907ab5e..ed2e52f869 100644
--- a/tests/benchmarks/qml/creation/tst_creation.cpp
+++ b/tests/benchmarks/qml/creation/tst_creation.cpp
@@ -204,19 +204,13 @@ void tst_creation::qobject_qmltype()
}
}
-struct QQmlGraphics_Derived : public QObject
-{
- void setParent_noEvent(QObject *parent) {
- bool sce = d_ptr->sendChildEvents;
- d_ptr->sendChildEvents = false;
- setParent(parent);
- d_ptr->sendChildEvents = sce;
- }
-};
-
inline void QQmlGraphics_setParent_noEvent(QObject *object, QObject *parent)
{
- static_cast<QQmlGraphics_Derived *>(object)->setParent_noEvent(parent);
+ QObjectPrivate *d_ptr = QObjectPrivate::get(object);
+ bool sce = d_ptr->sendChildEvents;
+ d_ptr->sendChildEvents = false;
+ object->setParent(parent);
+ d_ptr->sendChildEvents = sce;
}
void tst_creation::itemtree_notree_cpp()