[Telepathy-commits] [telepathy-qt4/master] ConnectionManager: Only start introspection/become ready if valid.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Fri Feb 13 10:42:52 PST 2009


---
 TelepathyQt4/Client/connection-manager.cpp |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/TelepathyQt4/Client/connection-manager.cpp b/TelepathyQt4/Client/connection-manager.cpp
index b41af07..153511b 100644
--- a/TelepathyQt4/Client/connection-manager.cpp
+++ b/TelepathyQt4/Client/connection-manager.cpp
@@ -352,8 +352,10 @@ ConnectionManager::ConnectionManager(const QString &name, QObject *parent)
       OptionalInterfaceFactory<ConnectionManager>(this),
       mPriv(new Private(name, this))
 {
-    mPriv->introspectQueue.enqueue(&ConnectionManager::callReadConfig);
-    QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    if (isValid()) {
+        mPriv->introspectQueue.enqueue(&ConnectionManager::callReadConfig);
+        QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    }
 }
 
 /**
@@ -370,8 +372,10 @@ ConnectionManager::ConnectionManager(const QDBusConnection &bus,
       OptionalInterfaceFactory<ConnectionManager>(this),
       mPriv(new Private(name, this))
 {
-    mPriv->introspectQueue.enqueue(&ConnectionManager::callReadConfig);
-    QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    if (isValid()) {
+        mPriv->introspectQueue.enqueue(&ConnectionManager::callReadConfig);
+        QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    }
 }
 
 /**
@@ -477,6 +481,11 @@ bool ConnectionManager::isReady() const
  */
 PendingOperation *ConnectionManager::becomeReady()
 {
+    if (!isValid()) {
+        return new PendingFailure(this, TELEPATHY_ERROR_NOT_AVAILABLE,
+                "ConnectionManager is invalid");
+    }
+
     if (mPriv->ready) {
         return new PendingSuccess(this);
     }
-- 
1.5.6.5




More information about the telepathy-commits mailing list