aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2014-01-14 12:28:25 +0100
committerThomas Hartmann <Thomas.Hartmann@digia.com>2014-01-14 12:29:20 +0100
commitb0c5380d556516dc238d0eb26fa1377cf62ed81c (patch)
tree5192ee246c29ddbd7b5938a6239c97852d20956a /src
parentac40c26eaf823fde3537147c882b3a1cd4820bf3 (diff)
QmlDesigner.FormEditor: crash fix
Anchors and/or anchor targets might be invalid. e.g.: anchors.left: parent We have to check this. Task-number: QTCREATORBUG-11255 Change-Id: Ib939292d0f89cc1d22119972627c03f1e85043db Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmldesigner/components/formeditor/anchorindicatorgraphicsitem.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/qmldesigner/components/formeditor/anchorindicatorgraphicsitem.cpp b/src/plugins/qmldesigner/components/formeditor/anchorindicatorgraphicsitem.cpp
index 7e7a21a67b..38d8db1e4b 100644
--- a/src/plugins/qmldesigner/components/formeditor/anchorindicatorgraphicsitem.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/anchorindicatorgraphicsitem.cpp
@@ -211,24 +211,26 @@ static void updateAnchorLinePoints(QPointF *firstPoint, QPointF *secondPoint, co
void AnchorIndicatorGraphicsItem::updateAnchorIndicator(const AnchorLine &sourceAnchorLine, const AnchorLine targetAnchorLine)
{
- m_sourceAnchorLineType = sourceAnchorLine.type();
- m_targetAnchorLineType = targetAnchorLine.type();
+ if (sourceAnchorLine.isValid() && targetAnchorLine.isValid()) {
+ m_sourceAnchorLineType = sourceAnchorLine.type();
+ m_targetAnchorLineType = targetAnchorLine.type();
- m_startPoint = createAnchorPoint(sourceAnchorLine.qmlItemNode(), sourceAnchorLine.type());
+ m_startPoint = createAnchorPoint(sourceAnchorLine.qmlItemNode(), sourceAnchorLine.type());
- if (targetAnchorLine.qmlItemNode() == sourceAnchorLine.qmlItemNode().instanceParentItem())
- m_endPoint = createParentAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type(), sourceAnchorLine.qmlItemNode());
- else
- m_endPoint = createAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type());
+ if (targetAnchorLine.qmlItemNode() == sourceAnchorLine.qmlItemNode().instanceParentItem())
+ m_endPoint = createParentAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type(), sourceAnchorLine.qmlItemNode());
+ else
+ m_endPoint = createAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type());
- m_firstControlPoint = createControlPoint(m_startPoint, sourceAnchorLine.type(), m_endPoint);
- m_secondControlPoint = createControlPoint(m_endPoint, targetAnchorLine.type(), m_startPoint);
+ m_firstControlPoint = createControlPoint(m_startPoint, sourceAnchorLine.type(), m_endPoint);
+ m_secondControlPoint = createControlPoint(m_endPoint, targetAnchorLine.type(), m_startPoint);
- updateAnchorLinePoints(&m_sourceAnchorLineFirstPoint, &m_sourceAnchorLineSecondPoint, sourceAnchorLine);
- updateAnchorLinePoints(&m_targetAnchorLineFirstPoint, &m_targetAnchorLineSecondPoint, targetAnchorLine);
+ updateAnchorLinePoints(&m_sourceAnchorLineFirstPoint, &m_sourceAnchorLineSecondPoint, sourceAnchorLine);
+ updateAnchorLinePoints(&m_targetAnchorLineFirstPoint, &m_targetAnchorLineSecondPoint, targetAnchorLine);
- updateBoundingRect();
- update();
+ updateBoundingRect();
+ update();
+ }
}
void AnchorIndicatorGraphicsItem::updateBoundingRect()