summaryrefslogtreecommitdiff
path: root/telepathy-glib/dbus.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2009-05-27 11:47:12 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2009-05-27 11:47:12 +0100
commit9a5abffc8cdaf411c41d97f06d8aec0efd25b9d4 (patch)
treecf2fc2eb910fea72718af1395ba62c2ad45238d1 /telepathy-glib/dbus.c
parent4aa7142b7576f958fe0d2b3ced4bd33b51146c64 (diff)
downloadtelepathy-glib-9a5abffc8cdaf411c41d97f06d8aec0efd25b9d4.tar.gz
_tp_dbus_daemon_get_name_owner: fail gracefully if TpDBusDaemon was invalidated
Diffstat (limited to 'telepathy-glib/dbus.c')
-rw-r--r--telepathy-glib/dbus.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index 092b0e4b6..7ae06ba93 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");