From ddc35a0fba647a9824ae45b135ff5cd098392684 Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 1 Dec 2009 11:44:51 +0100 Subject: Assistant: Fix race condition in CLucene indexer. We need to make sure the running thread can respond to the cancel request before overwriting it. Reviewed-by: kh1 --- tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp | 1 + tools/assistant/lib/qhelpsearchindexwriter_default.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp index ab32537..b9aedbe 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp @@ -578,6 +578,7 @@ void QHelpSearchIndexWriter::cancelIndexing() void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile, const QString &indexFilesFolder, bool reindex) { + wait(); mutex.lock(); this->m_cancel = false; this->m_reindex = reindex; diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp index 06deb85..60b9642 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp @@ -184,6 +184,7 @@ void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile, const QString &indexFilesFolder, bool reindex) { + wait(); QMutexLocker lock(&mutex); this->m_cancel = false; -- cgit v0.12