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

List:       kde-commits
Subject:    branches/KDE/4.3/kdelibs/nepomuk/core
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2009-07-21 9:32:28
Message-ID: 1248168748.051242.23061.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1000408 by trueg:

backport: thread-safe initialization

 M  +7 -0      nepomukmainmodel.cpp  


--- branches/KDE/4.3/kdelibs/nepomuk/core/nepomukmainmodel.cpp #1000407:1000408
@@ -41,6 +41,8 @@
 #include <kdebug.h>
 
 #include <QtCore/QTimer>
+#include <QtCore/QMutex>
+#include <QtCore/QMutexLocker>
 
 
 // FIXME: connect to some NepomukServer signal which emit enabled/disabled information
@@ -80,6 +82,8 @@
     Soprano::Util::DummyModel* dummyModel;
 
     void init() {
+        QMutexLocker lock( &m_initMutex );
+
         if ( !dbusModel ) {
             dbusModel = dbusClient.createModel( "main" );
         }
@@ -109,6 +113,8 @@
     Soprano::Model* model() {
         init();
 
+        QMutexLocker lock( &m_initMutex );
+
         // we always prefer the faster local socket client
         if ( localSocketModel ) {
             if ( mutexModel->parentModel() != localSocketModel ) {
@@ -132,6 +138,7 @@
 
 private:
     bool m_socketConnectFailed;
+    QMutex m_initMutex;
 };
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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