diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2010-03-18 16:47:13 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2010-03-18 16:56:47 +0100 |
commit | 7d423d5f96e7e65ccfe4359094dc5c4a7e1e5de5 (patch) | |
tree | a119e8be759e68ae6e883d5fdc6b15c2c2bdafe3 | |
parent | 0cb8416502c81d309d10f7f29a8a77118a0bce6e (diff) | |
download | qt-creator-7d423d5f96e7e65ccfe4359094dc5c4a7e1e5de5.tar.gz |
QmlDesigner: Fix crash in property editor when parent of an item is invalid
Happened for
import Qt 4.6
Flipable {
Rectangle {}
}
-rw-r--r-- | src/plugins/qmldesigner/components/propertyeditor/siblingcombobox.cpp | 19 | ||||
-rw-r--r-- | tests/manual/qml/testfiles/flipable.qml | 6 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/siblingcombobox.cpp b/src/plugins/qmldesigner/components/propertyeditor/siblingcombobox.cpp index 5c677348cf..1309adea5e 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/siblingcombobox.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/siblingcombobox.cpp @@ -87,19 +87,20 @@ void SiblingComboBox::setup() } QmlItemNode parent(m_itemNode.instanceParent().toQmlItemNode()); - m_itemList.prepend(parent); - QString parentString("Parent ("); - if (parent.id().isEmpty()) - parentString += parent.simplfiedTypeName(); - else - parentString += parent.id(); - parentString += ")"; - insertItem(0, parentString); + if (parent.isValid()) { + m_itemList.prepend(parent); + QString parentString("Parent ("); + if (parent.id().isEmpty()) + parentString += parent.simplfiedTypeName(); + else + parentString += parent.id(); + parentString += ")"; + insertItem(0, parentString); + } setCurrentIndex(m_itemList.indexOf(m_selectedItemNode)); connect(this, SIGNAL(currentIndexChanged (int)), this, SLOT(changeSelection(int))); - } diff --git a/tests/manual/qml/testfiles/flipable.qml b/tests/manual/qml/testfiles/flipable.qml new file mode 100644 index 0000000000..16af9d7827 --- /dev/null +++ b/tests/manual/qml/testfiles/flipable.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Rectangle { + width: 640 + height: 480 +} |