[Telepathy-commits] [telepathy-qt4/master] StatefulDBusProxy: make calling invalidate() twice not be an error

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Jan 12 07:56:25 PST 2009


We should just ignore the second invalidate() call and keep the first
one, with a debug message.

Also, add debug messages. When debugging we will probably want to know
when a service dies.
---
 TelepathyQt4/Client/dbus-proxy.cpp |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/TelepathyQt4/Client/dbus-proxy.cpp b/TelepathyQt4/Client/dbus-proxy.cpp
index f79bad1..8b92fcb 100644
--- a/TelepathyQt4/Client/dbus-proxy.cpp
+++ b/TelepathyQt4/Client/dbus-proxy.cpp
@@ -144,9 +144,19 @@ QString StatefulDBusProxy::invalidationMessage() const
 
 void StatefulDBusProxy::invalidate(const QString &reason, const QString &message)
 {
-    Q_ASSERT(isValid());
+    if (!isValid()) {
+        debug().nospace() << "Already invalidated by "
+            << mPriv->invalidationReason
+            << ", not replacing with " << reason
+            << " \"" << message << "\"";
+        return;
+    }
+
     Q_ASSERT(!reason.isEmpty());
 
+    debug().nospace() << "proxy invalidated: " << reason
+        << ": " << message;
+
     mPriv->invalidationReason = reason;
     mPriv->invalidationMessage = message;
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list