forked from qt-creator/qt-creator
QmlDesigner: Fix crash for QQuickStyleItem
QQuickStyleItem crashes if componentComplete() is called. Change-Id: I1df1b50f6ba95c0eda1ff8e18de85276a6de04f5 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -167,6 +167,26 @@ void registerNodeInstanceMetaObject(QObject *object, QQmlEngine *engine)
|
||||
QQuickDesignerSupportProperties::registerNodeInstanceMetaObject(object, engine);
|
||||
}
|
||||
|
||||
static bool isQuickStyleItemMetaObject(const QMetaObject *metaObject)
|
||||
{
|
||||
if (metaObject) {
|
||||
if (metaObject->className() == QByteArrayLiteral("QQuickStyleItem"))
|
||||
return true;
|
||||
|
||||
return isQuickStyleItemMetaObject(metaObject->superClass());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isQuickStyleItem(QObject *object)
|
||||
{
|
||||
if (object)
|
||||
return isQuickStyleItemMetaObject(object->metaObject());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is used in share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
|
||||
QObject *createPrimitive(const QString &typeName, int majorNumber, int minorNumber, QQmlContext *context)
|
||||
{
|
||||
@@ -357,12 +377,15 @@ void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInsta
|
||||
doComponentCompleteRecursive(child, nodeInstanceServer);
|
||||
}
|
||||
|
||||
if (item) {
|
||||
static_cast<QQmlParserStatus*>(item)->componentComplete();
|
||||
} else {
|
||||
QQmlParserStatus *qmlParserStatus = dynamic_cast< QQmlParserStatus*>(object);
|
||||
if (qmlParserStatus)
|
||||
qmlParserStatus->componentComplete();
|
||||
if (!isQuickStyleItem(item)) {
|
||||
qDebug() << Q_FUNC_INFO << item;
|
||||
if (item) {
|
||||
static_cast<QQmlParserStatus *>(item)->componentComplete();
|
||||
} else {
|
||||
QQmlParserStatus *qmlParserStatus = dynamic_cast<QQmlParserStatus *>(object);
|
||||
if (qmlParserStatus)
|
||||
qmlParserStatus->componentComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user