diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-05-14 03:15:08 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-05-14 03:15:08 (GMT) |
commit | 5cd963d2628ed7c01d331cdad03b4d77161c8b93 (patch) | |
tree | 42301ae7c37afb47b1daf897ed185e419a247304 /src/declarative/util/qdeclarativeanimation.cpp | |
parent | 873f755d1f40619174de0436dba293729f87bac9 (diff) | |
download | Qt-5cd963d2628ed7c01d331cdad03b4d77161c8b93.zip Qt-5cd963d2628ed7c01d331cdad03b4d77161c8b93.tar.gz Qt-5cd963d2628ed7c01d331cdad03b4d77161c8b93.tar.bz2 |
Fix crash in ParentAnimation.
copyOriginals plays with the order of the revertList, which messes up
the assumptions of ParentAnimation. The full fix will require some
rearchitecting of how the states and transitions handle "related"
actions, but for now this fixes the crash.
Reverting to the base state has also been fixed.
Task-number: QTBUG-10671, QTBUG-10676
Diffstat (limited to 'src/declarative/util/qdeclarativeanimation.cpp')
-rw-r--r-- | src/declarative/util/qdeclarativeanimation.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 0f7c946..67440b6 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2536,13 +2536,13 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, viaData->pc << vpc; viaData->actions << myAction; 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; + QDeclarativeAction &xAction = pc->xIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; + QDeclarativeAction &yAction = pc->yIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; + QDeclarativeAction &sAction = pc->scaleIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; + QDeclarativeAction &rAction = pc->rotationIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction; bool forward = (direction == QDeclarativeAbstractAnimation::Forward); 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; @@ -2583,9 +2583,9 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) { qreal w = target->width(); qreal h = target->height(); - if (pc->widthIsSet()) + if (pc->widthIsSet() && i < actions.size() - 1) w = actions[++i].toValue.toReal(); - if (pc->heightIsSet()) + if (pc->heightIsSet() && i < actions.size() - 1) h = actions[++i].toValue.toReal(); const QPointF &transformOrigin = d->computeTransformOrigin(target->transformOrigin(), w,h); |