aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2016-08-30 12:35:36 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2016-08-31 08:25:47 +0000
commitc13aa48d4cad8659af2b491e4b3ddbe46b38fcc5 (patch)
treedc601d09dfba3cd2897ca9f880166abe7fcd5910
parent88c37194b2168fb9f915aaaf07d3bfbc5dc8be3d (diff)
QML: treat permanent guards more like active guardsv5.8.0-alpha1
Esp. when disabling notifications and marking notifiers as "done". Change-Id: I2d1c3bf048b32f68680744250e4250c3c4d76660 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/qml/qqmlbinding.cpp2
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp10
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h8
3 files changed, 18 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 896bc8d51d..90698c3b24 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -252,6 +252,8 @@ protected:
}
+ cancelPermanentGuards();
+
ep->dereferenceScarceResources();
}
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index ebc4d49c36..8020bdb2be 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -115,12 +115,17 @@ QQmlJavaScriptExpression::~QQmlJavaScriptExpression()
void QQmlJavaScriptExpression::setNotifyOnValueChanged(bool v)
{
activeGuards.setFlagValue(v);
- if (!v) clearActiveGuards();
+ permanentGuards.setFlagValue(v);
+ if (!v) {
+ clearActiveGuards();
+ clearPermanentGuards();
+ m_permanentDependenciesRegistered = false;
+ }
}
void QQmlJavaScriptExpression::resetNotifyOnValueChanged()
{
- clearActiveGuards();
+ setNotifyOnValueChanged(false);
}
void QQmlJavaScriptExpression::setContext(QQmlContextData *context)
@@ -429,6 +434,7 @@ void QQmlJavaScriptExpression::clearActiveGuards()
void QQmlJavaScriptExpression::clearPermanentGuards()
{
+ m_permanentDependenciesRegistered = false;
while (QQmlJavaScriptExpressionGuard *g = permanentGuards.takeFirst())
g->Delete();
}
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index a5c7a80153..5f9cffb56d 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -146,6 +146,14 @@ public:
protected:
void createQmlBinding(QQmlContextData *ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line);
+ void cancelPermanentGuards() const
+ {
+ if (m_permanentDependenciesRegistered) {
+ for (QQmlJavaScriptExpressionGuard *it = permanentGuards.first(); it; it = permanentGuards.next(it))
+ it->cancelNotify();
+ }
+ }
+
private:
friend class QQmlContextData;
friend class QQmlPropertyCapture;