diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-09-17 04:47:20 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-09-21 05:10:11 (GMT) |
commit | f32fa315dd417384db63b11e908c7b10de10ef46 (patch) | |
tree | 94f798c9d0fa793f20ef075540050727ec32e403 | |
parent | f412a9cb0bd1438d1518cf6a8eda3fda5fbf64f5 (diff) | |
download | Qt-f32fa315dd417384db63b11e908c7b10de10ef46.zip Qt-f32fa315dd417384db63b11e908c7b10de10ef46.tar.gz Qt-f32fa315dd417384db63b11e908c7b10de10ef46.tar.bz2 |
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
(cherry picked from commit 0c971a9801766a6d7646d1c1c413354f74db41e4)
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 8 |
1 files 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: |