OSDN Git Service

QmlDesigner.model: avoid assert when setting current state (again)
authorThomas Hartmann <Thomas.Hartmann@nokia.com>
Wed, 20 Jul 2011 10:33:22 +0000 (12:33 +0200)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>
Wed, 20 Jul 2011 11:39:31 +0000 (13:39 +0200)
Task-number: QTCREATORBUG-5503
Change-Id: Ib6469b584e82f6b0cb579d5ab81658f918fd8690
Reviewed-on: http://codereview.qt.nokia.com/1877
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
src/plugins/qmldesigner/designercore/model/model.cpp
src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp

index e80286f..a780dcf 100644 (file)
@@ -96,6 +96,7 @@ ModelPrivate::ModelPrivate(Model *model) :
         m_internalIdCounter(1)
 {
     m_rootInternalNode = createNode("QtQuick/Item", 1, 0, PropertyListType(), PropertyListType(), QString(), ModelNode::NodeWithoutSource,true);
+    m_acutalStateNode = m_rootInternalNode;
 }
 
 ModelPrivate::~ModelPrivate()
index 01b5215..531a0fc 100644 (file)
@@ -63,7 +63,11 @@ void QmlModelView::setCurrentState(const QmlModelState &state)
     if (!state.isValid())
         return;
 
-    setAcutalStateNode(state.modelNode());
+    if (!model())
+        return;
+
+    if (actualStateNode() != state.modelNode())
+        setAcutalStateNode(state.modelNode());
 }
 
 QmlModelState QmlModelView::currentState() const