From dcfd75a1bb765b8c54d6bf31483160ad64115e95 Mon Sep 17 00:00:00 2001
From: Eike Ziller <eike.ziller@theqtcompany.com>
Date: Thu, 6 Nov 2014 14:58:17 +0100
Subject: [PATCH] QHelpContentModel: Fix that the model sometimes ended up
 empty

When aborting collecting the content items, sometimes the "abort" state
was not cleaned up correctly, so the next run thought it was aborted
too. If that happened at the end of the multiple start/abort cycles that
happen at initialization, the content model ended up empty.

Task-number: QTCREATORBUG-13233
Change-Id: Ia47a6b033cc3fd1f7a02d5194fb6f7ea68a435c5
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
---
 src/assistant/help/qhelpcontentwidget.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/assistant/help/qhelpcontentwidget.cpp b/src/assistant/help/qhelpcontentwidget.cpp
index 8f38bcfd3..1deaaf95a 100644
--- a/src/assistant/help/qhelpcontentwidget.cpp
+++ b/src/assistant/help/qhelpcontentwidget.cpp
@@ -219,6 +219,11 @@ void QHelpContentProvider::stopCollecting()
         m_abort = true;
         m_mutex.unlock();
         wait();
+        // we need to force-set m_abort to false, because the thread might either have
+        // finished between the isRunning() check and the "m_abort = true" above, or the
+        // isRunning() check might already happen after the "m_abort = false" in the run() method,
+        // either way never resetting m_abort to false from within the run() method
+        m_abort = false;
     }
     qDeleteAll(m_rootItems);
     m_rootItems.clear();
-- 
GitLab