Bug 28155 - TpBaseClient should be able to unregister itself
Summary: TpBaseClient should be able to unregister itself
Status: RESOLVED DUPLICATE of bug 27872
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Guillaume Desmottes
QA Contact: Telepathy bugs list
URL:
Whiteboard: review+ with trivial change
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-05-18 03:52 UTC by Simon McVittie
Modified: 2010-05-24 03:42 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Simon McVittie 2010-05-18 03:52:53 UTC
tp_base_client_register() takes a bus name and registers the Client on D-Bus. However, having done this, there's no way to revoke it.

Relatedly, dispose() does not release the bus name (although dbus-glib will remove the TpBaseClient from the object path automatically), which makes this a bug rather than merely a missing feature.

I propose this API:

/**
 * tp_base_client_unregister:
 * @self: a client, which may already have been registered with
 *  tp_base_client_register(), or not
 *
 * Remove this client object from D-Bus, if tp_base_client_register()
 * has already been called.
 *
 * If the object is not registered, this method may be called, but has
 * no effect.
 *
 * Releasing the last reference to the object also has the same effect
 * as calling this method, but this method should be preferred, as it
 * has more deterministic behaviour.
 *
 * If the object still exists, tp_base_client_register() may be used to
 * attempt to register it again.
 */
void tp_base_client_unregister (TpBaseClient *self);
Comment 2 Simon McVittie 2010-05-20 04:59:03 UTC
+  if (!tp_dbus_daemon_release_name (self->priv->dbus, self->priv->bus_name,
+        &error))
+    {
+      ERROR ("Failed to release bus name (%s): %s", self->priv->bus_name,
+          error->message);

I'd make this a WARNING() - it's an unsupported situation (the name must have been released other than via this function), but one that we do handle more or less gracefully.

The test looks good.
Comment 3 Guillaume Desmottes 2010-05-20 05:14:08 UTC
(In reply to comment #2)
> +  if (!tp_dbus_daemon_release_name (self->priv->dbus, self->priv->bus_name,
> +        &error))
> +    {
> +      ERROR ("Failed to release bus name (%s): %s", self->priv->bus_name,
> +          error->message);
> 
> I'd make this a WARNING() - it's an unsupported situation (the name must have
> been released other than via this function), but one that we do handle more or
> less gracefully.

done.
Comment 4 Simon McVittie 2010-05-24 03:42:15 UTC
Marking this as a pseudo-duplicate, since it'll be merged when Bug #27872 is (and not before).

*** This bug has been marked as a duplicate of bug 27872 ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.