Re: NetworkManager make errors and DBUS



On Thu, 2007-01-11 at 20:36 +1300, Simon Geard wrote:

> Oh, ok, hadn't heard that one. So, dbus_connection_disconnect() became
> _close(), and has now been replaced with _unref()?

No.

      * dbus_connection_disconnect has been renamed to
        dbus_connection_close
      * dbus_connection_unref tells libdbus to decrement the ref count
        for the given connection.  It does *not* replace
        dbus_connection_close.

The background is that a process normally only has a single connection
to the bus.  Even if you call dbus_bus_get several times at different
places in your code -- or concurrently in threads --, libdbus will
always return the same connection.  Thus, its named shared connection.
When dbus_bus_get_private is being called you get a private connection
which is not being shared.

Most of the time we're talking about shared connections, not private
ones (in D-Bus terms spoken).  You should never call
dbus_connection_close on such a shared connection.  If a part of your
application does no longer require a D-Bus connection, simply unref it
(dbus_connection_unref) and you're done.  You must not call
dbus_connection_close.

That's why closing a shared connection shall not be done but is alright
for a private connection.

   Timo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]