If you try to dbus_connection_close() then your overlords will laugh in your face. Hahhaha, your application has done something totally evil and will be ignored.

The truth is in D-Bus when you get a bus connection you do not own that connection. The only time you own a connection is when you create the connection yourself. Whenever using the dbus_bus_get API you are given a shared connection which is owned by libdbus. We keep weak refs around to make sure it only goes away when everyone is done with it including the library itself. Closing a shared connection would be very bad and in fact ancient versions of the library let you do just that. It wasn’t much a problem when D-Bus was being used in limited places. These days you are never sure who will be using D-Bus and if they will be linked into your app and using the very same shared connection to save resources (opening up a private connection for every library would be a huge waste though some do it for good reasons).

To that end newer versions of D-Bus simply ignore requests to close a connection if it is shared and print out a warning. If fatal warnings are on, your app will halt and sit for gdb to attach to it. It is recommended that apps which call this API remove the call and simply make sure they unref the connection appropriately. Unreffing will do the right thing(tm). Reserve dbus_connection_close for those days when your apps are creating their own private connections.

[read this post in: ar de es fr it ja ko pt ru zh-CN ]