How to detect DBus dying

John (J5) Palmieri johnp at redhat.com
Thu Sep 29 11:43:12 PDT 2005


If there is an API you are using that you need to work around the
easiest things to do is detect the version at build time and
conditionalize your code.  If you can, providing a function that is
equivalent to the fixed API could work.  Looking at the patch and it
looks like this won't be an option since it touches a lot of internal
code.   

Of course requiring a newer version of DBUS isn't a bad thing either
being that D-Bus is a moving target right now trying to fix things for
stable distros might be more work than it is worth.  My take on the
whole thing is if an application worked well enough to be included on a
stable system there should be a high bar to adding new functionality.
There will be a new release at some point soon which can integrate the
latest and greatest. It saves a lot of headache.  It would be nice if a
lot of that energy went to getting D-Bus to 1.0 so that we could just
deal with bug fixes and distros would have less of an issue with
updating to the latest bug fix release.

Using new_for_name might work depending on if the peer connection
ignores the name.  You could try doing it with a fake name like
"foo.bar" though I am not familiar with the GLib code for handling peer
connections.  Since you don't go over a bus it might not get evaluated.
Try it and see what happens.   

On Thu, 2005-09-29 at 19:05 +0100, Tony Houghton wrote:
> I'm trying to update ROX-Session to work with recent versions of DBus
> and I think I found a bug in the glib bindings
> <https://bugs.freedesktop.org/show_bug.cgi?id=4637>, which means I can't
> use dbus_g_proxy_new_for_peer. I'd like to be able to work around the
> problem in ROX-Session so it can be used eg with Ubuntu 5.10 without
> having to replace the dbus packages with a patched version.
> 
> ROX-Session includes, effectively, this bit of code:
> 
>     /* Get notified when the bus dies */
>     local = dbus_g_proxy_new_for_peer(
>             dbus_connection_glib,
>             DBUS_PATH_LOCAL, DBUS_INTERFACE_LOCAL);
>     g_signal_connect(G_OBJECT(local), "destroy",
>             G_CALLBACK(lost_connection), NULL);
> 
> Is there a better way to detect DBus dying or can I just replace the
> call with dbus_g_proxy_new_for_name? If so, what should I use as the
> name?
> 
> If I shouldn't be doing this at all I guess it's OK to remove that code
> altogether, because it considers the condition fatal anyway and all
> lost_connection() does is to clear the application's reference to the
> connection and warn the user to restart the X session.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list