forked from qt-creator/qt-creator
QmlDesigner: Fix crash in puppet when component has errors
Check component creation errors earlier to avoid crash. This allows puppet to notify creator about the problem, so invalid components can be properly highlighted in navigator. Change-Id: I059a5be04c4e509a38f6d47daa97e0da36c333ae Fixes: QDS-1887 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -753,10 +753,14 @@ QObject *ObjectNodeInstance::createComponent(const QString &componentPath, QQmlC
|
||||
Q_UNUSED(disableComponentComplete)
|
||||
|
||||
QQmlComponent component(context->engine(), fixComponentPathForIncompatibleQt(componentPath));
|
||||
QObject *object = component.beginCreate(context);
|
||||
|
||||
QObject *object = nullptr;
|
||||
if (!component.isError()) {
|
||||
object = component.beginCreate(context);
|
||||
QmlPrivateGate::tweakObjects(object);
|
||||
component.completeCreate();
|
||||
QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership);
|
||||
}
|
||||
|
||||
if (component.isError()) {
|
||||
qDebug() << componentPath;
|
||||
@@ -764,8 +768,6 @@ QObject *ObjectNodeInstance::createComponent(const QString &componentPath, QQmlC
|
||||
qWarning() << error;
|
||||
}
|
||||
|
||||
QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user