diff options
author | Marco Bubke <marco.bubke@digia.com> | 2012-10-15 14:48:57 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@digia.com> | 2012-10-15 17:53:58 +0200 |
commit | 174eb7c270d13589954523b6cdf90a9d4ff75624 (patch) | |
tree | 7fb018cffc1e1f31a4ca1e2edf2adf67ab8324a0 /share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp | |
parent | 19c561c505d02bec7bbfad9cdf856144c1ad246a (diff) |
QmlDesigner.NodeInstances: Fix crash for instance without object
Change-Id: Ia08cdb194e8f67a71cdbddf162cc7f17daa517f8
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp index 60be2cb677..9a6572ccfa 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp @@ -213,8 +213,17 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe object = Internal::ObjectNodeInstance::createPrimitive(instanceContainer.type(), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context()); } - if ((object == 0) && (instanceContainer.metaType() == InstanceContainer::ItemMetaType)) //If we cannot instanciate the object but we know it has to be an Ttem, we create an Item instead. - object = Internal::ObjectNodeInstance::createPrimitive("QtQuick/Item", 2, 0, nodeInstanceServer->context()); + if (object == 0) { + if (instanceContainer.metaType() == InstanceContainer::ItemMetaType) { //If we cannot instanciate the object but we know it has to be an Ttem, we create an Item instead. + object = Internal::ObjectNodeInstance::createPrimitive("QtQuick/Item", 2, 0, nodeInstanceServer->context()); + + if (object == 0) + object = new QQuickItem; + } else { + object = new QObject; + } + } + QQmlEnginePrivate::get(nodeInstanceServer->engine())->cache(object->metaObject()); |