Detectin mainloop integration

Havoc Pennington hp at
Mon Oct 1 09:07:05 PDT 2007


On 9/29/07, Sebastian Dröge <slomo at> wrote:
> Refcount on what? They currently ref/unref the main context that gets
> set and in my local branch ref/unref the connection (from the GSources,
> unref happens when either it's unsetup or the GMainContext gets freed).

The point is if there's an unsetup(), you have to call it N times if
you did setup() N times. Otherwise, you can't know it's safe to
unsetup() since someone else may have setup() also.

I would think that either we need the setup/unsetup pairing like this,
or we should not have an unsetup() since using it would be

> For themselves it makes sense to call setup more than once, even when
> there's only one corresponding unsetup somewhere, as with the current
> behaviour it simply unintegrates from the old GMainContext and
> integrates into the new. Do you think it makes sense to stop this
> behaviour?

Calling setup() twice on the same connection should be a no-op I
think, except that if there's an unsetup() you should have to call it
as many times as you called setup().

The point is that a plugin or something should be able to setup()
"just in case" without knowing if the main app already did it.

> I only added it now because of a assertion in dbus-glib
> (dbus_connection_get_g_connection).

Yeah, we should just get rid of this I think.

> Sounds good, having such <1000 line library separate is insane :) Also
> having some kind of C convenience lib is definitely needed IMHO.

Can you prepare a patch against the dbus git repo?


More information about the dbus mailing list