[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/runtime/nepomuk/services/strigi
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2010-12-10 9:54:29
Message-ID: 20101210095429.97064AC8A6 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1205172 by trueg:

Protect read-only calls to the dirsToUpdate queue to be sure the queue is not changed while we check it
which could lead to a dead-lock.

 M  +9 -3      indexscheduler.cpp  


--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/indexscheduler.cpp #1205171:1205172
@@ -257,6 +257,7 @@
     while ( waitForContinue() ) {
         // wait for more dirs to analyze in case the initial
         // indexing is done
+        m_dirsToUpdateMutex.lock();
         if ( m_dirsToUpdate.isEmpty() ) {
             setIndexingStarted( false );
 
@@ -264,9 +265,7 @@
             kDebug() << "All folders updated: " << timer.elapsed()/1000.0 << "sec";
 #endif
 
-            m_dirsToUpdateMutex.lock();
             m_dirsToUpdateWc.wait( &m_dirsToUpdateMutex );
-            m_dirsToUpdateMutex.unlock();
 
 #ifndef NDEBUG
             timer.restart();
@@ -275,6 +274,7 @@
             if ( !m_stopped )
                 setIndexingStarted( true );
         }
+        m_dirsToUpdateMutex.unlock();
 
         // wait for resume or stop (or simply continue)
         if ( !waitForContinue() ) {
@@ -303,10 +303,16 @@
 }
 
 
-bool Nepomuk::IndexScheduler::analyzeDir( const QString& dir, UpdateDirFlags flags )
+bool Nepomuk::IndexScheduler::analyzeDir( const QString& dir_, UpdateDirFlags flags )
 {
 //    kDebug() << dir << analyzer << recursive;
 
+    // normalize the dir name, otherwise things might break below
+    QString dir( dir_ );
+    if( dir.endsWith(QLatin1String("/")) ) {
+        dir.truncate( dir.length()-1 );
+    }
+
     // inform interested clients
     emit indexingFolder( dir );
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic