[telepathy-glib/master] _tp_dbus_daemon_get_name_owner: fail gracefully if TpDBusDaemon was invalidated

Simon McVittie simon.mcvittie at collabora.co.uk
Wed May 27 03:47:12 PDT 2009


---
 telepathy-glib/dbus.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index 092b0e4..7ae06ba 100644
--- a/telepathy-glib/dbus.c
+++ b/telepathy-glib/dbus.c
@@ -975,12 +975,29 @@ _tp_dbus_daemon_get_name_owner (TpDBusDaemon *self,
                                 gchar **unique_name,
                                 GError **error)
 {
-  DBusGConnection *gconn = tp_proxy_get_dbus_connection (self);
-  DBusConnection *dbc = dbus_g_connection_get_connection (gconn);
+  DBusGConnection *gconn;
+  DBusConnection *dbc;
   DBusMessage *message;
   DBusMessage *reply;
   DBusError dbus_error;
   const char *name_in_reply;
+  const GError *invalidated;
+
+  g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  invalidated = tp_proxy_get_invalidated (self);
+
+  if (invalidated != NULL)
+    {
+      if (error != NULL)
+        *error = g_error_copy (invalidated);
+
+      return FALSE;
+    }
+
+  gconn = tp_proxy_get_dbus_connection (self);
+  dbc = dbus_g_connection_get_connection (gconn);
 
   message = dbus_message_new_method_call (DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
       DBUS_INTERFACE_DBUS, "GetNameOwner");
-- 
1.5.6.5



More information about the telepathy-commits mailing list