aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickbehavior.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@jollamobile.com>2014-02-10 10:16:08 -0600
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-20 04:27:24 +0100
commitbd510dfa02f33fa497894fe8aa4236f7d8705482 (patch)
tree2a07b5c25506daa889de8d52d921ec34b4b7ffd5 /src/quick/util/qquickbehavior.cpp
parent7da483bfbefcaabb1dbbf3e2f1d5b5f7aadc3b06 (diff)
Ensure Behavior stops animating when a new value is set while disabled.
Otherwise the Behavior could cause the property value to end up in an unwanted and inconsistent state. For example, in the following case: x: myXValue Behavior on x { NumberAnimation {} } x could end up *not equal* to myXValue if myXValue was changed while the Behavior was still animating but currently disabled. Change-Id: I3826fdc3f48b2722e778638b116546db7e831e87 Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'src/quick/util/qquickbehavior.cpp')
-rw-r--r--src/quick/util/qquickbehavior.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index 407b80915d..74e5b40ab1 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -180,6 +180,8 @@ void QQuickBehavior::write(const QVariant &value)
if (!bypass)
qmlExecuteDeferred(this);
if (!d->animation || bypass) {
+ if (d->animationInstance)
+ d->animationInstance->stop();
QQmlPropertyPrivate::write(d->property, value, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
d->targetValue = value;
return;