diff options
author | Jian Liang <jianliang79@gmail.com> | 2015-12-25 21:36:46 +0800 |
---|---|---|
committer | jian liang <jianliang79@gmail.com> | 2016-01-22 14:07:19 +0000 |
commit | 3cc589c98390992e3ee8a7970dc2913ea857d623 (patch) | |
tree | 6c058e0bcd2c31661d370e7baed66d4cffaae32a /src/qml/types | |
parent | 2d7921184e86c9dcd4189bd7da79b3fa050abedc (diff) |
Make sure we destroy all QV4::QObjectWrapper objects
Delay freeing QObjectWrapper Value to MemoryManager::sweep() to make sure
we can destroy all QObjectWrapper objects.
We also keep track of QObjectWrapper in QV4::Heap::ModelObject to make
sure we destory them in QV4::MemoryManager::sweep()
Change-Id: I3a8a3b07faab1f88c2eb746f68aa8d9584b40026
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; } } |