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

List:       kde-commits
Subject:    KDE/kdebase/runtime/nepomuk/server
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2011-01-17 16:09:55
Message-ID: 20110117160955.4B64CAC8B5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1215091 by trueg:

Properly handle DBus error replies when checking the init state of services.
This fixes a bug where services are started before the deps are initialized
and all sorts of problems appear.

BUG: 245266

 M  +12 -3     servicecontroller.cpp  


--- trunk/KDE/kdebase/runtime/nepomuk/server/servicecontroller.cpp #1215090:1215091
@@ -25,6 +25,7 @@
 #include <QtCore/QTimer>
 
 #include <QtDBus/QDBusServiceWatcher>
+#include <QtDBus/QDBusPendingReply>
 
 #include <KStandardDirs>
 #include <KConfigGroup>
@@ -321,20 +322,28 @@
 void Nepomuk::ServiceController::createServiceControlInterface()
 {
     delete d->serviceControlInterface;
-
     d->serviceControlInterface = new OrgKdeNepomukServiceControlInterface( \
                dbusServiceName( name() ),
-                                                                           \
"/servicecontrol", +                                                                  \
                QLatin1String("/servicecontrol"),
                                                                            \
                QDBusConnection::sessionBus(),
                                                                            this );
-    if( d->serviceControlInterface->isInitialized() ) {
+    QDBusPendingReply<bool> isInitializedReply = \
d->serviceControlInterface->isInitialized(); +    \
isInitializedReply.waitForFinished(); +    if( isInitializedReply.isError() ) {
+        kDebug() << "Failed to check service init state for" << name() << \
"Retrying."; +        QMetaObject::invokeMethod( this, \
"createServiceControlInterface", Qt::QueuedConnection ); +    }
+    else {
+        if( isInitializedReply.value() ) {
         slotServiceInitialized( true );
     }
     else {
+            kDebug() << "Service" << name() << "not initialized yet. Listening for \
                signal.";
         connect( d->serviceControlInterface, SIGNAL( serviceInitialized( bool ) ),
                  this, SLOT( slotServiceInitialized( bool ) ),
                  Qt::QueuedConnection );
     }
 }
+}
 
 
 void Nepomuk::ServiceController::slotServiceInitialized( bool success )


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

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