From 6dd1ab81e1c7943053feea321b6f7774b688ee5d Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 25 Aug 2011 17:03:10 +1000 Subject: [PATCH] Fix memory leak in ListModel custom parser ModelNodes created by the parser for ListElement definitions were not deleted. (cherry picked from commit c1491c356f3cca92a359468ce37f38bc1873eec4) Task-number: QTBUG-21084 Change-Id: Ic55a054bb8e30cdabd11080e4f827df5deb1a014 Reviewed-on: http://codereview.qt.nokia.com/3567 Reviewed-by: Qt Sanity Bot Reviewed-by: Michael Brasser --- src/declarative/util/qdeclarativelistmodel.cpp | 1 + src/qtquick1/util/qdeclarativelistmodel.cpp | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 15d87c8..da841c1 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -932,6 +932,7 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray & QDeclarativeListModel *rv = static_cast(obj); ModelNode *root = new ModelNode(rv->m_nested); + rv->m_nested->m_ownsRoot = true; rv->m_nested->_root = root; QStack nodes; nodes << root; diff --git a/src/qtquick1/util/qdeclarativelistmodel.cpp b/src/qtquick1/util/qdeclarativelistmodel.cpp index d5aa75b..08e15c5 100644 --- a/src/qtquick1/util/qdeclarativelistmodel.cpp +++ b/src/qtquick1/util/qdeclarativelistmodel.cpp @@ -787,6 +787,7 @@ void QDeclarative1ListModelParser::setCustomData(QObject *obj, const QByteArray QDeclarative1ListModel *rv = static_cast(obj); ModelNode *root = new ModelNode(rv->m_nested); + rv->m_nested->m_ownsRoot = true; rv->m_nested->_root = root; QStack nodes; nodes << root; -- 1.7.2.5