dbus_g_connection_close() ?

Mark McLoughlin mark at skynet.ie
Wed Sep 7 10:54:46 PDT 2005


On Tue, 2005-09-06 at 20:18 -0400, Havoc Pennington wrote:
> On Tue, 2005-09-06 at 15:25 -0400, Colin Walters wrote:
> > 
> > We should probably also fix libdbus to get rid of the idea of refcounts
> > for shared connections; e.g. the docs for dbus_connection_open shouldn't
> > mention the refcount, and dbus_connection_{ref,unref} should have
> > _dbus_return_val_if_fail (!connection->shared, NULL) or whatever.
> > 
> 
> I think the right way (I'm not sure it currently works this way) is that
> the global variable for the shared connection owns a ref. This ref is
> tied to whether the connection is connected. So when the connection is
> closed or disconnects, the global variable is set to NULL and drops its
> refcount.

	Okay, that sounds reasonable. Here's an attempt at that which does it
in a pretty wacky way - the pre-allocated "disconnected" message holds a
ref on the connection so that we can safely dispatch the disconnected
message after removing it from shared_connections even when no users of
the connection currently hold a ref.

	Some of the tests in dbus/bus/dispatch.c are failing, the docs probably
still need updating and we need to nullify the pointer in
bus_connections as well as removing it from shared_connection ... but it
would be good if you could look over it to see if its in the right
direction.

Cheers,
Mark.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shared-connections.diff
Type: text/x-patch
Size: 5382 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050907/57836b5f/shared-connections-0001.bin


More information about the dbus mailing list