QHelpContentModel: Fix that the model sometimes ended up empty
authorEike Ziller <eike.ziller@theqtcompany.com>
Thu, 6 Nov 2014 13:58:17 +0000 (14:58 +0100)
committerEike Ziller <eike.ziller@theqtcompany.com>
Fri, 7 Nov 2014 09:18:47 +0000 (10:18 +0100)
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

index 8f38bcf..1deaaf9 100644 (file)
@@ -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();