dbus_shutdown call
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Jan 9 04:24:22 PST 2008
On Wed, 09 Jan 2008 at 09:47:51 +0100, Ge@@ru wrote:
> In this case on my application i do:
> - dbus_bus_get (system bus)
> - dbus_bus_request_name;
> - ... do method call
> - dbus_connection_unref()
> - dbus_shutdown
> - exit
>
> On session bus this works fine, on system bus
> before exit an abort is handled for:
> dbus_shutdown() called but connections were still live. This probably
> means the application did not drop all its references to bus
> connections.
>
> So, i can't shutdown on system bus.
You're probably linked against a library that also uses the system bus.
In general you can't do that with shared connections, because you don't
know who else will be using them.
Don't call dbus_shutdown unless you know that your code is the only user
of libdbus in the process. You'll get a few "memory leaks" showing up in
valgrind; work out which ones are libdbus internals (thread locks and
things like that) and ignore them.
The documentation of dbus_shutdown also suggests that it can be useful
if an application dlopens libdbus, but I don't think its semantics are
very useful in that case, since code that's dlopened can't (in general)
know whether someone else has *also* dlopened libdbus. I think the only
solution for the dlopen case would be some sort of dbus_library_ref and
dbus_library_unref semantics (just like the way dlopen and dlclose are
defined in terms of refcounting, in fact...)
More information about the dbus
mailing list