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

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


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

diff --git a/TelepathyQt4/Client/connection.cpp b/TelepathyQt4/Client/connection.cpp
index 513b9f5..59e784a 100644
--- a/TelepathyQt4/Client/connection.cpp
+++ b/TelepathyQt4/Client/connection.cpp
@@ -523,8 +523,10 @@ Connection::Connection(const QString &serviceName,
       OptionalInterfaceFactory<Connection>(this),
       mPriv(new Private(this))
 {
-    mPriv->introspectQueue.enqueue(&Private::startIntrospection);
-    QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    if (isValid()) {
+        mPriv->introspectQueue.enqueue(&Private::startIntrospection);
+        QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    }
 }
 
 /**
@@ -543,8 +545,10 @@ Connection::Connection(const QDBusConnection &bus,
       OptionalInterfaceFactory<Connection>(this),
       mPriv(new Private(this))
 {
-    mPriv->introspectQueue.enqueue(&Private::startIntrospection);
-    QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    if (isValid()) {
+        mPriv->introspectQueue.enqueue(&Private::startIntrospection);
+        QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+    }
 }
 
 /**
@@ -1324,6 +1328,11 @@ bool Connection::isReady(Features features) const
  */
 PendingOperation *Connection::becomeReady(Features requestedFeatures)
 {
+    if (!isValid()) {
+        return new PendingFailure(this, TELEPATHY_ERROR_NOT_AVAILABLE,
+                "Connection is invalid");
+    }
+
     if (isReady(requestedFeatures)) {
         return new PendingSuccess(this);
     }
-- 
1.5.6.5




More information about the telepathy-commits mailing list