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

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


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

diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index 37d5ec8..8477c70 100644
--- a/telepathy-glib/dbus.c
+++ b/telepathy-glib/dbus.c
@@ -1057,14 +1057,29 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,
                              GError **error)
 {
   TpProxy *as_proxy = (TpProxy *) self;
-  DBusGConnection *gconn = as_proxy->dbus_connection;
-  DBusConnection *dbc = dbus_g_connection_get_connection (gconn);
+  DBusGConnection *gconn;
+  DBusConnection *dbc;
   DBusError dbus_error;
   int result;
+  const GError *invalidated;
 
   g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE);
   g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name,
         TP_DBUS_NAME_TYPE_WELL_KNOWN, error), 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 = as_proxy->dbus_connection;
+  dbc = dbus_g_connection_get_connection (gconn);
 
   dbus_error_init (&dbus_error);
   result = dbus_bus_request_name (dbc, well_known_name,
-- 
1.5.6.5




More information about the telepathy-commits mailing list