From da6360b85d311d94b8d19126286404c0cc8c76fe Mon Sep 17 00:00:00 2001 From: Daiwei Li Date: Fri, 23 Jan 2015 14:33:35 -0800 Subject: [PATCH] Fix crash when invalidating qqmltypeloader Change-Id: I16db2ea9a6c25d26e2b803b9bb8d9ef7156e254d Reviewed-by: Gunnar Sletta Reviewed-by: Simon Hausmann --- src/qml/qml/qqmltypeloader.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 1b222fe..0ac1d7f 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -903,15 +903,18 @@ QQmlDataLoader::~QQmlDataLoader() void QQmlDataLoader::invalidate() { - for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter) - (*iter)->release(); - m_networkReplies.clear(); - if (m_thread) { shutdownThread(); delete m_thread; m_thread = 0; } + + // Need to delete the network replies after + // the loader thread is shutdown as it could be + // getting new replies while we clear them + for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter) + (*iter)->release(); + m_networkReplies.clear(); } void QQmlDataLoader::lock() -- 2.7.4