Low-level API: dbus_bus_get() + dbus_connection_set_exit_on_disconnect() in a library
Havoc Pennington
hp at pobox.com
Fri Aug 19 14:00:43 PDT 2011
Hi,
On Tue, Aug 16, 2011 at 11:10 AM, Michał Górny <mgorny at gentoo.org> wrote:
> I'm developing a small library using the D-Bus low-level API. I'd like
> to use the dbus_bus_get() function but it seems that calling
> dbus_connection_set_exit_on_disconnect(..., FALSE) on a connection
> returned by that function is a bad idea.
>
It's sort of "defined" that if you connect to the session bus you're
part of the session and should thus exit with it. (it causes a lot of
problems for sysadmins on multiuser systems if sessions leave leftover
processes; historically the default exit-on-disconnect behavior of
Xlib solved the issue)
This is the right behavior for 99% of apps, that's why it's the default
If you are in the 1% (maybe you aren't in the session, just "peeking"
at it) then get_private is probably totally correct to use. It's not
_that_ much memory.
Havoc
More information about the dbus
mailing list