diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-04-21 16:42:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-10 07:55:36 +0000 |
commit | 37d02d62d8d14fdaa0884f96f7840661413a95c2 (patch) | |
tree | 8e3f3dd9dafd574b99ca686e657d7e73f8f7eef5 /src/quick/util/qquickpropertychanges.cpp | |
parent | eb7db5934b453eea2946ed7ae9a188c44467cf23 (diff) |
Make bindings refcounted
Refcounting our bindings greatly simplifies our memory management
of the objects and ensures we safely clean them all up. In addition,
it allows us to remove the m_mePtr and weak reference handling from
QQmlAbstractBinding as we can safely handle this through the same
mechanism.
Change-Id: If23ebc8be276096146952b0008b62018f5d57faf
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/quick/util/qquickpropertychanges.cpp')
-rw-r--r-- | src/quick/util/qquickpropertychanges.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 707323f2e2..bb8b5250a0 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -464,10 +464,10 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() // XXX TODO: add a static QQmlJavaScriptExpression::evaluate(QString) // so that we can avoid creating then destroying the binding in this case. a.toValue = newBinding->evaluate(); - newBinding->destroy(); + delete newBinding; } else { newBinding->setTarget(prop); - a.toBinding = QQmlAbstractBinding::getPointer(newBinding); + a.toBinding = newBinding; a.deletableToBinding = true; } @@ -558,7 +558,7 @@ void QQuickPropertyChanges::changeValue(const QString &name, const QVariant &val if (entry.name == name) { expressionIterator.remove(); if (state() && state()->isStateActive()) { - QQmlPropertyPrivate::removeBinding(d->property(name), QQmlPropertyPrivate::DestroyOldBinding); + QQmlPropertyPrivate::removeBinding(d->property(name)); d->property(name).write(value); } @@ -656,10 +656,10 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString // XXX TODO: add a static QQmlJavaScriptExpression::evaluate(QString) // so that we can avoid creating then destroying the binding in this case. action.toValue = newBinding->evaluate(); - newBinding->destroy(); + delete newBinding; } else { newBinding->setTarget(action.property); - action.toBinding = QQmlAbstractBinding::getPointer(newBinding); + action.toBinding = newBinding; action.deletableToBinding = true; state()->addEntryToRevertList(action); |