[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:       2011-01-11 12:44:54
Message-ID: 20110111124454.C47D2AC8B2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1213736 by trueg:

Protect the Strigi config with a mutex.

 M  +7 -1      strigiserviceconfig.cpp  
 M  +3 -0      strigiserviceconfig.h  


--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/strigiserviceconfig.cpp \
#1213735:1213736 @@ -174,14 +174,17 @@
 bool Nepomuk::StrigiServiceConfig::shouldFileBeIndexed( const QString& fileName ) \
const  {
     // check the filters
+    QMutexLocker lock( &m_folderCacheMutex );
     return !m_excludeFilterRegExpCache.exactMatch( fileName );
 }
 
 
 bool Nepomuk::StrigiServiceConfig::folderInFolderList( const QString& path, bool& \
exact ) const  {
-    QString p = KUrl( path ).path( KUrl::RemoveTrailingSlash );
+    QMutexLocker lock( &m_folderCacheMutex );
 
+    const QString p = KUrl( path ).path( KUrl::RemoveTrailingSlash );
+
     // we traverse the list backwards to catch all exclude folders
     int i = m_folderCache.count();
     while ( --i >= 0 ) {
@@ -249,6 +252,8 @@
 
 void Nepomuk::StrigiServiceConfig::buildFolderCache()
 {
+    QMutexLocker lock( &m_folderCacheMutex );
+
     QStringList includeFoldersPlain = m_config.group( "General" ).readPathEntry( \
                "folders", QStringList() << QDir::homePath() );
     org::kde::nepomuk::RemovableStorage removableStorageService( \
                "org.kde.nepomuk.services.removablestorageservice",
                                                                  \
"/removablestorageservice", @@ -266,6 +271,7 @@
 
 void Nepomuk::StrigiServiceConfig::buildExcludeFilterRegExpCache()
 {
+    QMutexLocker lock( &m_folderCacheMutex );
     m_excludeFilterRegExpCache.rebuildCacheFromFilterList( excludeFilters() );
 }
 
--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/strigiserviceconfig.h \
#1213735:1213736 @@ -22,6 +22,7 @@
 #include <QtCore/QObject>
 #include <QtCore/QList>
 #include <QtCore/QRegExp>
+#include <QtCore/QMutex>
 
 #include <kconfig.h>
 #include <kio/global.h>
@@ -137,6 +138,8 @@
         /// cache of regexp objects for all exclude filters
         /// to prevent regexp parsing over and over
         RegExpCache m_excludeFilterRegExpCache;
+
+        mutable QMutex m_folderCacheMutex;
     };
 }
 


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

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