diff options
author | Jian Liang <jianliang79@gmail.com> | 2015-11-18 22:30:26 +0800 |
---|---|---|
committer | jian liang <jianliang79@gmail.com> | 2015-12-18 15:52:43 +0000 |
commit | 839d2d3e2368bc8e107d22203b0611c852f54319 (patch) | |
tree | 6ea5f2b5bb5fca87e37872352f24c85649589ac2 /src/qml/types | |
parent | 4b018848f7a7055976895de8a4b8208b58a36fac (diff) |
Fix QtSharedPointer::ExternalRefCountData object leaks
Call destroyObject() for every QV4::Heap::QObectWrapper object in heap in
QV4::MemoryManager::sweep() to make sure the QPointer object contained in
QV4::Heap::QObjectWrapper is properly destructed.
We also keep track of QObjectWrapper in QV4::Heap::ModelObject to make
sure we destory them in QV4::MemoryManager::sweep()
Change-Id: I3b3e96cfc300c2e21ab691762879ac2970afa90c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index a4c0f7043f..4b0aa47c63 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -2277,6 +2277,9 @@ QQmlV4Handle QQmlListModel::get(int index) const } else { QObject *object = m_listModel->getOrCreateModelObject(const_cast<QQmlListModel *>(this), index); result = scope.engine->memoryManager->allocObject<QV4::ModelObject>(object, const_cast<QQmlListModel *>(this), index); + // Keep track of the QObjectWrapper in persistent value storage + QV4::Value *val = scope.engine->memoryManager->m_weakValues->allocate(); + *val = result; } } |