Commit 29c97b45 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.textToModelMerger: avoid possible crash

The setup should be after changing the type. Also we have to check for the
case where the ModelNode is the root node.
parent 69b9cb8c
......@@ -767,13 +767,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
propertyIsComponentType(modelNode.parentProperty()) ?
QLatin1String("QtQuick.Component") : typeName;
if (isComponentType(typeNameFixedForImplicitComponents))
setupComponent(modelNode);
if (isCustomParserType(typeName))
setupCustomParserNode(modelNode);
if (modelNode.parentProperty().isValid() && modelNode.type() != typeNameFixedForImplicitComponents //If there is no valid parentProperty
if ((modelNode.parentProperty().isValid() || modelNode.isRootNode()) && modelNode.type() != typeNameFixedForImplicitComponents //If there is no valid parentProperty
//the node has just been created. The type is correct then.
/*|| modelNode.majorVersion() != domObject.objectTypeMajorVersion()
|| modelNode.minorVersion() != domObject.objectTypeMinorVersion()*/) {
......@@ -785,6 +779,12 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
return; // the difference handler will create a new node, so we're done.
}
if (isComponentType(typeNameFixedForImplicitComponents))
setupComponent(modelNode);
if (isCustomParserType(typeName))
setupCustomParserNode(modelNode);
context->enterScope(astNode);
QSet<QString> modelPropertyNames = QSet<QString>::fromList(modelNode.propertyNames());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment