This is a step towards replacing with-session-bus*.sh with GTestDBus,
which cleans up our D-Bus connection while the test is still running.
If we do that without this change, then the NameLost callback is triggered
when we get disconnected from D-Bus, causing an assertion failure.
This also should reduce circular references, by making sure closures
that contain "this" get cleaned up.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=690830
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
public bool debug { get; set; }
private LibsocialwebServerTest lsw_server;
+ private uint _name_id = 0;
public signal void ready ();
assert_not_reached ();
}
- Bus.own_name (
+ this._name_id = Bus.own_name (
BusType.SESSION, LIBSOCIALWEB_BUS_NAME,
BusNameOwnerFlags.NONE,
on_bus_aquired,
public void tear_down ()
{
+ if (this._name_id != 0)
+ {
+ Bus.unown_name (this._name_id);
+ this._name_id = 0;
+ }
}
}