GDBusConnection: when to close, when to unref

David Zeuthen zeuthen at
Sat Jun 8 11:02:01 PDT 2013


On Fri, Jun 7, 2013 at 3:30 AM, Simon McVittie
<simon.mcvittie at> wrote:
> Private connections are like file objects: it's best to
> close-then-unref. It is not an error to just do the unref, but that way
> you can't detect errors, and if you have leaked a ref somewhere, the
> connection will remain open.

Depending on your application, you may also want to flush [1] the
connection before closing and unreffing it. In the file analogy above,
this is similar to how you sometimes want to fsync(2) a file before
close(2)'ing it.


[1] :

More information about the dbus mailing list