summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-09-02 09:45:16 +1000
committerMichael Brasser <michael.brasser@nokia.com>2011-09-02 15:27:12 +1000
commit8570c509f505a4b238905122645a80faa768adb5 (patch)
tree16f7207a0658c4edc7eea71c4d8d3fd81ce134d1 /src/declarative/util
parent3750d24175904916fe5ab8b1a76db956b1904e72 (diff)
Fix leak in State element.
If a state was destroyed while active, it would leak bindings. Task-number: QTBUG-21194 Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qdeclarativestate.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 9f56ccb02e..ee3d06b4db 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -173,6 +173,18 @@ QDeclarativeState::~QDeclarativeState()
Q_D(QDeclarativeState);
if (d->group)
d->group->removeState(this);
+
+ /*
+ destroying an active state does not return us to the
+ base state, so we need to clean up our revert list to
+ prevent leaks. In the future we may want to redconsider
+ this overall architecture.
+ */
+ for (int i = 0; i < d->revertList.count(); ++i) {
+ if (d->revertList.at(i).binding()) {
+ d->revertList.at(i).binding()->destroy();
+ }
+ }
}
/*!