diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-05-14 00:01:07 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-05-14 00:15:53 (GMT) |
commit | 8f800ea5611be333ae15f932dfea50bc80852c03 (patch) | |
tree | c4af5a1616a8a447796bc7fbf34a7bc7affe174a | |
parent | cce4e4393277298b5b5246ab79e615173b2cb13a (diff) | |
download | Qt-8f800ea5611be333ae15f932dfea50bc80852c03.zip Qt-8f800ea5611be333ae15f932dfea50bc80852c03.tar.gz Qt-8f800ea5611be333ae15f932dfea50bc80852c03.tar.bz2 |
Fix crash in ParentAnimation.
When rolling-back a parent change, the actions are in reverse order.
Task-number: QTBUG-10671
-rw-r--r-- | src/declarative/util/qdeclarativeanimation.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 0f7c946..195939f 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2535,14 +2535,15 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, myAction.event = vpc; viaData->pc << vpc; viaData->actions << myAction; + int index = i; + bool invertedIndex = (direction == QDeclarativeAbstractAnimation::Forward) && action.reverseEvent; QDeclarativeAction dummyAction; - QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &yAction = pc->yIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[++i] : dummyAction; - QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[++i] : dummyAction; - bool forward = (direction == QDeclarativeAbstractAnimation::Forward); + QDeclarativeAction &xAction = pc->xIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; + QDeclarativeAction &yAction = pc->yIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; + QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; + QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[invertedIndex ? --index : ++i] : dummyAction; QDeclarativeItem *target = pc->object(); - QDeclarativeItem *targetParent = forward ? pc->parent() : pc->originalParent(); + QDeclarativeItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent(); //### this mirrors the logic in QDeclarativeParentChange. bool ok; @@ -2584,9 +2585,9 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, qreal w = target->width(); qreal h = target->height(); if (pc->widthIsSet()) - w = actions[++i].toValue.toReal(); + w = actions[invertedIndex ? --index : ++i].toValue.toReal(); if (pc->heightIsSet()) - h = actions[++i].toValue.toReal(); + h = actions[invertedIndex ? --index : ++i].toValue.toReal(); const QPointF &transformOrigin = d->computeTransformOrigin(target->transformOrigin(), w,h); qreal tempxt = transformOrigin.x(); |