From 5a52ae5e95867b420c647082573290a9e2596bdd Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 25 Aug 2009 10:46:35 +1000 Subject: Remove the QmlBinding_Id from QmlContext on destruction --- src/declarative/qml/qmlbindingoptimizations.cpp | 12 +++++++++++- src/declarative/qml/qmlbindingoptimizations_p.h | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qmlbindingoptimizations.cpp b/src/declarative/qml/qmlbindingoptimizations.cpp index e1f4a90..e4ca358 100644 --- a/src/declarative/qml/qmlbindingoptimizations.cpp +++ b/src/declarative/qml/qmlbindingoptimizations.cpp @@ -64,6 +64,11 @@ QmlBinding_Id::QmlBinding_Id(QObject *object, int propertyIdx, QmlAbstractExpression::setContext(context); } +QmlBinding_Id::~QmlBinding_Id() +{ + removeFromContext(); +} + void QmlBinding_Id::setEnabled(bool e) { if (e) { @@ -103,7 +108,7 @@ void QmlBinding_Id::update() } } -void QmlBinding_Id::reset() +void QmlBinding_Id::removeFromContext() { if (m_prev) { *m_prev = m_next; @@ -111,6 +116,11 @@ void QmlBinding_Id::reset() m_next = 0; m_prev = 0; } +} + +void QmlBinding_Id::reset() +{ + removeFromContext(); QObject *o = 0; void *a[] = { &o, 0 }; diff --git a/src/declarative/qml/qmlbindingoptimizations_p.h b/src/declarative/qml/qmlbindingoptimizations_p.h index 2d2ffec..ab264c7 100644 --- a/src/declarative/qml/qmlbindingoptimizations_p.h +++ b/src/declarative/qml/qmlbindingoptimizations_p.h @@ -65,7 +65,8 @@ class QmlBinding_Id : public QmlAbstractExpression, { public: QmlBinding_Id(QObject *object, int propertyIdx, - QmlContext *context, int id); + QmlContext *context, int id); + virtual ~QmlBinding_Id(); // Inherited from QmlAbstractBinding virtual void setEnabled(bool); @@ -75,6 +76,8 @@ public: void reset(); private: + void removeFromContext(); + QmlBinding_Id **m_prev; QmlBinding_Id *m_next; -- cgit v0.12