From 0c971a9801766a6d7646d1c1c413354f74db41e4 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 17 Sep 2010 14:47:20 +1000 Subject: Fix QDeclarativeXmlQuery mutex locking and don't wait for new jobs if the query has already quit Task-number: QTBUG-13041 Reviewed-by: Aaron Kennedy --- src/declarative/util/qdeclarativexmllistmodel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 47b502d..f0ed80b 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -209,8 +209,9 @@ Q_SIGNALS: protected: void run() { + m_mutex.lock(); + while (!m_quit) { - m_mutex.lock(); if (!m_jobs.isEmpty()) m_currentJob = m_jobs.dequeue(); m_mutex.unlock(); @@ -230,12 +231,13 @@ protected: m_mutex.lock(); if (m_currentJob.queryId != -1 && m_abortQueryId != m_currentJob.queryId) emit queryCompleted(r); - if (m_jobs.isEmpty()) + if (m_jobs.isEmpty() && !m_quit) m_condition.wait(&m_mutex); m_currentJob.queryId = -1; m_abortQueryId = -1; - m_mutex.unlock(); } + + m_mutex.unlock(); } private: -- cgit v0.12