summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2012-12-14 14:29:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-17 14:07:54 +0100
commit1ee2a1c1be22485b46021b3ec7a5f4ebca3a5c92 (patch)
tree6d075987238d6114b75ca051a78ee72bb8c96220
parent1aaf1bb3f556e775d070cb3bf4c487f5fe74b291 (diff)
Enable exceptions code, makes Assistant far more stable.
Task-number: QTBUG-28592 The reason to enable exceptions (always) is that we build the full text engine with exceptions as well, which throws erratic. Once it does that the database it creates is in a unknow state, which leads to new exceptions on next Assistant start. So it will never start again until someone removes the broken index by hand. Change-Id: Ic24a9e28bddf4657753f9b670c38ecda527d7af4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
-rw-r--r--src/assistant/help/help.pro14
-rw-r--r--src/assistant/help/qhelpsearchindexreader_clucene.cpp5
-rw-r--r--src/assistant/help/qhelpsearchindexwriter_clucene.cpp18
3 files changed, 14 insertions, 23 deletions
diff --git a/src/assistant/help/help.pro b/src/assistant/help/help.pro
index ffdac1b40..ed75c37ca 100644
--- a/src/assistant/help/help.pro
+++ b/src/assistant/help/help.pro
@@ -10,6 +10,20 @@ load(qt_module)
DEFINES -= QT_ASCII_CAST_WARNINGS
+# impossible to disable exceptions in clucene atm and use help lib without
+CONFIG(exceptions_off) {
+ CONFIG -= exceptions_off
+ CONFIG += exceptions
+ !win32|win32-g++* {
+ QMAKE_CFLAGS -= -fno-exceptions
+ QMAKE_CXXFLAGS -= -fno-exceptions
+ QMAKE_LFLAGS -= -fno-exceptions
+ QMAKE_CFLAGS += -fexceptions
+ QMAKE_CXXFLAGS += -fexceptions
+ QMAKE_LFLAGS += -fexceptions
+ }
+}
+
RESOURCES += helpsystem.qrc
SOURCES += qhelpenginecore.cpp \
qhelpengine.cpp \
diff --git a/src/assistant/help/qhelpsearchindexreader_clucene.cpp b/src/assistant/help/qhelpsearchindexreader_clucene.cpp
index b1172f259..1221b38b6 100644
--- a/src/assistant/help/qhelpsearchindexreader_clucene.cpp
+++ b/src/assistant/help/qhelpsearchindexreader_clucene.cpp
@@ -107,9 +107,7 @@ void QHelpSearchIndexReaderClucene::run()
emit searchingStarted();
-#if !defined(QT_NO_EXCEPTIONS)
try {
-#endif
QCLuceneBooleanQuery booleanQueryTitle;
QCLuceneBooleanQuery booleanQueryContent;
QCLuceneStandardAnalyzer analyzer;
@@ -199,15 +197,12 @@ void QHelpSearchIndexReaderClucene::run()
if ((count > 0) && boost)
boostSearchHits(engine, hitList, queryList);
emit searchingFinished(hitList.count());
-
-#if !defined(QT_NO_EXCEPTIONS)
} catch(...) {
mutex.lock();
hitList.clear();
mutex.unlock();
emit searchingFinished(0);
}
-#endif
}
}
diff --git a/src/assistant/help/qhelpsearchindexwriter_clucene.cpp b/src/assistant/help/qhelpsearchindexwriter_clucene.cpp
index 1c5d13afc..c70d5ecd5 100644
--- a/src/assistant/help/qhelpsearchindexwriter_clucene.cpp
+++ b/src/assistant/help/qhelpsearchindexwriter_clucene.cpp
@@ -591,9 +591,7 @@ void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile,
void QHelpSearchIndexWriter::optimizeIndex()
{
-#if !defined(QT_NO_EXCEPTIONS)
try {
-#endif
if (QCLuceneIndexReader::indexExists(m_indexFilesFolder)) {
if (QCLuceneIndexReader::isLocked(m_indexFilesFolder))
return;
@@ -603,19 +601,15 @@ void QHelpSearchIndexWriter::optimizeIndex()
writer.optimize();
writer.close();
}
-#if !defined(QT_NO_EXCEPTIONS)
} catch (...) {
qWarning("Full Text Search, could not optimize index.");
return;
}
-#endif
}
void QHelpSearchIndexWriter::run()
{
-#if !defined(QT_NO_EXCEPTIONS)
try {
-#endif
QMutexLocker mutexLocker(&mutex);
if (m_cancel)
@@ -801,13 +795,9 @@ void QHelpSearchIndexWriter::run()
}
}
}
-
-#if !defined(QT_NO_EXCEPTIONS)
} catch (...) {
qWarning("%s: Failed because of CLucene exception.", Q_FUNC_INFO);
}
-#endif
-
emit indexingFinished();
}
@@ -824,16 +814,12 @@ bool QHelpSearchIndexWriter::addDocuments(const QList<QUrl> docFiles,
QCLuceneDocument document;
DocumentHelper helper(url.toString(), engine.fileData(url));
if (helper.addFieldsToDocument(&document, namespaceName, attrList)) {
-#if !defined(QT_NO_EXCEPTIONS)
try {
-#endif
writer->addDocument(document, analyzer);
-#if !defined(QT_NO_EXCEPTIONS)
} catch (...) {
qWarning("Full Text Search, could not properly add documents.");
return false;
}
-#endif
}
locker.relock();
if (m_cancel)
@@ -880,16 +866,12 @@ QList<QUrl> QHelpSearchIndexWriter::indexableFiles(QHelpEngineCore *helpEngine,
void QHelpSearchIndexWriter::closeIndexWriter(QCLuceneIndexWriter *writer)
{
-#if !defined(QT_NO_EXCEPTIONS)
try {
-#endif
writer->close();
delete writer;
-#if !defined(QT_NO_EXCEPTIONS)
} catch (...) {
qWarning("Full Text Search, could not properly close index writer.");
}
-#endif
}
} // namespace clucene