From 9b09cbd11e8708420b683478203e9919e5a5aa2a Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 26 Jun 2012 23:14:23 +0200 Subject: [PATCH] * Call wipeIndex via a single-shot timer to avoid dead-locks. --- src/libtomahawk/database/FuzzyIndex.cpp | 16 ++++++++-------- src/libtomahawk/database/FuzzyIndex.h | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/libtomahawk/database/FuzzyIndex.cpp b/src/libtomahawk/database/FuzzyIndex.cpp index 017e1bb4b..64db5b690 100644 --- a/src/libtomahawk/database/FuzzyIndex.cpp +++ b/src/libtomahawk/database/FuzzyIndex.cpp @@ -83,7 +83,7 @@ FuzzyIndex::wipeIndex() endIndexing(); QTimer::singleShot( 0, this, SLOT( updateIndex() ) ); - + return true; // FIXME } @@ -189,8 +189,8 @@ FuzzyIndex::appendFields( const QMap< unsigned int, QMap< QString, QString > >& catch( CLuceneError& error ) { tDebug() << "Caught CLucene error:" << error.what(); - - wipeIndex(); + + QTimer::singleShot( 0, this, SLOT( wipeIndex() ) ); } } @@ -282,9 +282,9 @@ FuzzyIndex::search( const Tomahawk::query_ptr& query ) } catch( CLuceneError& error ) { - tDebug() << "Caught CLucene error:" << error.what(); - - wipeIndex(); + tDebug() << "Caught CLucene error:" << error.what() << query->toString(); + + QTimer::singleShot( 0, this, SLOT( wipeIndex() ) ); } return resultsmap; @@ -338,8 +338,8 @@ FuzzyIndex::searchAlbum( const Tomahawk::query_ptr& query ) catch( CLuceneError& error ) { tDebug() << "Caught CLucene error:" << error.what(); - - wipeIndex(); + + QTimer::singleShot( 0, this, SLOT( wipeIndex() ) ); } return resultsmap; diff --git a/src/libtomahawk/database/FuzzyIndex.h b/src/libtomahawk/database/FuzzyIndex.h index e1f0be693..96af77cf8 100644 --- a/src/libtomahawk/database/FuzzyIndex.h +++ b/src/libtomahawk/database/FuzzyIndex.h @@ -61,7 +61,7 @@ public: void beginIndexing(); void endIndexing(); void appendFields( const QMap< unsigned int, QMap< QString, QString > >& trackData ); - + signals: void indexReady(); @@ -73,10 +73,9 @@ public slots: private slots: void updateIndex(); - -private: bool wipeIndex(); +private: QMutex m_mutex; QString m_lucenePath;