summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-08-25 00:46:35 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-08-25 00:46:35 (GMT)
commit5a52ae5e95867b420c647082573290a9e2596bdd (patch)
treeacad7a180988826f9f78b287866e62f4f989e641 /src/declarative/qml
parentf9ef0e9ec1cd253beb1c0f06d2dae130e1bfa5cb (diff)
downloadQt-5a52ae5e95867b420c647082573290a9e2596bdd.zip
Qt-5a52ae5e95867b420c647082573290a9e2596bdd.tar.gz
Qt-5a52ae5e95867b420c647082573290a9e2596bdd.tar.bz2
Remove the QmlBinding_Id from QmlContext on destruction
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlbindingoptimizations.cpp12
-rw-r--r--src/declarative/qml/qmlbindingoptimizations_p.h5
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;