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

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


---
 TelepathyQt4/Client/account-manager.cpp |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/TelepathyQt4/Client/account-manager.cpp b/TelepathyQt4/Client/account-manager.cpp
index 36d4953..2003185 100644
--- a/TelepathyQt4/Client/account-manager.cpp
+++ b/TelepathyQt4/Client/account-manager.cpp
@@ -154,7 +154,9 @@ AccountManager::AccountManager(QObject* parent)
       OptionalInterfaceFactory<AccountManager>(this),
       mPriv(new Private(this))
 {
-    init();
+    if (isValid()) {
+        init();
+    }
 }
 
 /**
@@ -171,7 +173,9 @@ AccountManager::AccountManager(const QDBusConnection& bus,
       OptionalInterfaceFactory<AccountManager>(this),
       mPriv(new Private(this))
 {
-    init();
+    if (isValid()) {
+        init();
+    }
 }
 
 /**
@@ -369,6 +373,11 @@ bool AccountManager::isReady(Features features) const
  */
 PendingOperation *AccountManager::becomeReady(Features features)
 {
+    if (!isValid()) {
+        return new PendingFailure(this, TELEPATHY_ERROR_NOT_AVAILABLE,
+                "AccountManager is invalid");
+    }
+
     if (isReady(features)) {
         return new PendingSuccess(this);
     }
-- 
1.5.6.5




More information about the telepathy-commits mailing list