diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-09-01 23:45:16 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2011-09-02 05:27:12 (GMT) |
commit | 8570c509f505a4b238905122645a80faa768adb5 (patch) | |
tree | 16f7207a0658c4edc7eea71c4d8d3fd81ce134d1 /src | |
parent | 3750d24175904916fe5ab8b1a76db956b1904e72 (diff) | |
download | Qt-8570c509f505a4b238905122645a80faa768adb5.zip Qt-8570c509f505a4b238905122645a80faa768adb5.tar.gz Qt-8570c509f505a4b238905122645a80faa768adb5.tar.bz2 |
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')
-rw-r--r-- | src/declarative/util/qdeclarativestate.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 9f56ccb..ee3d06b 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(); + } + } } /*! |