Commit b0c5380d authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

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: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent ac40c26e
...@@ -211,24 +211,26 @@ static void updateAnchorLinePoints(QPointF *firstPoint, QPointF *secondPoint, co ...@@ -211,24 +211,26 @@ static void updateAnchorLinePoints(QPointF *firstPoint, QPointF *secondPoint, co
void AnchorIndicatorGraphicsItem::updateAnchorIndicator(const AnchorLine &sourceAnchorLine, const AnchorLine targetAnchorLine) void AnchorIndicatorGraphicsItem::updateAnchorIndicator(const AnchorLine &sourceAnchorLine, const AnchorLine targetAnchorLine)
{ {
m_sourceAnchorLineType = sourceAnchorLine.type(); if (sourceAnchorLine.isValid() && targetAnchorLine.isValid()) {
m_targetAnchorLineType = targetAnchorLine.type(); 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()) if (targetAnchorLine.qmlItemNode() == sourceAnchorLine.qmlItemNode().instanceParentItem())
m_endPoint = createParentAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type(), sourceAnchorLine.qmlItemNode()); m_endPoint = createParentAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type(), sourceAnchorLine.qmlItemNode());
else else
m_endPoint = createAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type()); m_endPoint = createAnchorPoint(targetAnchorLine.qmlItemNode(), targetAnchorLine.type());
m_firstControlPoint = createControlPoint(m_startPoint, sourceAnchorLine.type(), m_endPoint); m_firstControlPoint = createControlPoint(m_startPoint, sourceAnchorLine.type(), m_endPoint);
m_secondControlPoint = createControlPoint(m_endPoint, targetAnchorLine.type(), m_startPoint); m_secondControlPoint = createControlPoint(m_endPoint, targetAnchorLine.type(), m_startPoint);
updateAnchorLinePoints(&m_sourceAnchorLineFirstPoint, &m_sourceAnchorLineSecondPoint, sourceAnchorLine); updateAnchorLinePoints(&m_sourceAnchorLineFirstPoint, &m_sourceAnchorLineSecondPoint, sourceAnchorLine);
updateAnchorLinePoints(&m_targetAnchorLineFirstPoint, &m_targetAnchorLineSecondPoint, targetAnchorLine); updateAnchorLinePoints(&m_targetAnchorLineFirstPoint, &m_targetAnchorLineSecondPoint, targetAnchorLine);
updateBoundingRect(); updateBoundingRect();
update(); update();
}
} }
void AnchorIndicatorGraphicsItem::updateBoundingRect() void AnchorIndicatorGraphicsItem::updateBoundingRect()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment