aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickbehavior.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-11-29 10:51:29 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2019-11-29 14:37:16 +0100
commit991035ea1f00671d79c340a8a5c038e6aae1ece7 (patch)
tree769afdec530be9fdb728976d3312fda72157c83f /src/quick/util/qquickbehavior.cpp
parent510770c464e413f5758c5e64e9770f222c7e6bd0 (diff)
QQuickBehavior: Check that animation is not semi-deleted
QQuickPopup::~QQuickPopup hides its overlay in its destructor. If a Behavior is installed on its opacity property, it will get triggered by this. If the animation associated with the Behavior is a property of the Popup, which is bound to a QML element, it will however be already partially destructed, as QQmlElement<QQuickPopup>::~QQmlElement and in turn QQmlPrivate::qdeclarativeelement_destructor will have deleted its associated memory, before QQuickPopup::~QQuickPopup has been called. As this does not set any pointers to null, it would seem as if the Animation were still valid. To remedy this, we now check if the animation is in fact marked for deletetion, and, if so, bypass the interception. Fixes: QTBUG-80070 Change-Id: I0e33262c6b3963c46e300ae76c05063c00ff258b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/quick/util/qquickbehavior.cpp')
-rw-r--r--src/quick/util/qquickbehavior.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index ae5c481e2f..eee8562a2a 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -196,7 +196,7 @@ void QQuickBehavior::write(const QVariant &value)
bool bypass = !d->enabled || !d->finalized || QQmlEnginePrivate::designerMode();
if (!bypass)
qmlExecuteDeferred(this);
- if (!d->animation || bypass) {
+ if (QQmlData::wasDeleted(d->animation) || bypass) {
if (d->animationInstance)
d->animationInstance->stop();
QQmlPropertyPrivate::write(d->property, value, QQmlPropertyData::BypassInterceptor | QQmlPropertyData::DontRemoveBinding);