aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Watson <glenn.watson@nokia.com>2012-02-06 08:44:18 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-06 04:10:32 +0100
commit9d12cc1544028ee12e0355c364e3a36360236638 (patch)
tree821cb6d82c63be79cba280c627e597ad2422b7e8
parent21270c1b9a414cec825ef4c94de120da6126098a (diff)
Fix incorrect ref count with dynamic roles on worker thread.
When using the dynamic roles mode from a worker script thread, the reference count for the list model worker agent was not being incremented correctly, causing the final release of the agent to be reading from memory that had already been freed. Change-Id: I06d8e363c95133c1c162f32e1efb2d4020ed96be Reviewed-by: Martin Jones <martin.jones@nokia.com>
-rw-r--r--src/declarative/qml/qdeclarativelistmodel.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativelistmodel.cpp b/src/declarative/qml/qdeclarativelistmodel.cpp
index 65b3de9d31..ce7235e548 100644
--- a/src/declarative/qml/qdeclarativelistmodel.cpp
+++ b/src/declarative/qml/qdeclarativelistmodel.cpp
@@ -1522,6 +1522,9 @@ QDeclarativeListModel *QDeclarativeListModel::createWithOwner(QDeclarativeListMo
model->m_agent = newOwner->m_agent;
model->m_dynamicRoles = newOwner->m_dynamicRoles;
+ if (model->m_mainThread && model->m_agent)
+ model->m_agent->addref();
+
QDeclarativeEngine::setContextForObject(model, QDeclarativeEngine::contextForObject(newOwner));
return model;