From 37e603bcd9333f161960726c777edccb873f9d91 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 5 Mar 2014 15:44:53 +0100 Subject: [PATCH] QmlDesigner.ContextMenu: Fixing possible crash If an item is created but not (yet) in the hierarchy, but gets selected, the parent property is not valid. We should check for this case. Change-Id: I965bc20172bfd58b0b1759d3b0907971dfe142f1 Reviewed-by: Marco Bubke --- .../components/componentcore/designeractionmanager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index 53ca0feee3f..0af6af8c23b 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -158,7 +158,10 @@ public: } if (m_action->isEnabled()) { ModelNode parentNode; - if (m_selectionContext.singleNodeIsSelected() && !m_selectionContext.currentSingleSelectedNode().isRootNode()) { + if (m_selectionContext.singleNodeIsSelected() + && !m_selectionContext.currentSingleSelectedNode().isRootNode() + && m_selectionContext.currentSingleSelectedNode().hasParentProperty()) { + ActionTemplate *selectionAction = new ActionTemplate(QString(), &ModelNodeOperations::select); selectionAction->setParent(m_menu.data());