OSDN Git Service

QmlDesigner.nodeInstances: crash fix for QmlPuppet
authorThomas Hartmann <Thomas.Hartmann@nokia.com>
Tue, 1 Mar 2011 15:55:16 +0000 (16:55 +0100)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>
Tue, 1 Mar 2011 16:21:05 +0000 (17:21 +0100)
We have to check if the instance is valid.

src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.cpp

index 8e791a9..0a2cb5d 100644 (file)
@@ -1157,16 +1157,18 @@ void NodeInstanceServer::findItemChangesAndSendChangeCommands()
                 const ServerNodeInstance instance = property.first;
                 const QString propertyName = property.second;
 
-                if (instance.isRootNodeInstance() && (propertyName == "width" || propertyName == "height"))
-                    adjustSceneRect = true;
+                if (instance.isValid()) {
+                    if (instance.isRootNodeInstance() && (propertyName == "width" || propertyName == "height"))
+                        adjustSceneRect = true;
 
-                if (propertyName.contains("anchors") && informationChangedInstanceSet.contains(instance))
-                    informationChangedInstanceSet.insert(instance);
+                    if (propertyName.contains("anchors") && informationChangedInstanceSet.contains(instance))
+                        informationChangedInstanceSet.insert(instance);
+
+                    if (propertyName == "parent") {
+                        informationChangedInstanceSet.insert(instance);
+                        parentChangedSet.insert(instance);
+                    }
 
-                if (propertyName == "parent") {
-                    informationChangedInstanceSet.insert(instance);
-                    parentChangedSet.insert(instance);
-                } else {
                     propertyChangedList.append(property);
                 }
             }