[folks] LibsocialwebTest: don't try to keep ownership of name through tear_down()
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] LibsocialwebTest: don't try to keep ownership of name through tear_down()
- Date: Wed, 20 Mar 2013 11:52:44 +0000 (UTC)
commit aa81aee77a19b0decb61df453f322fc78405e7d7
Author: Simon McVittie <simon mcvittie collabora co uk>
Date: Fri Mar 15 15:35:51 2013 +0000
LibsocialwebTest: don't try to keep ownership of name through tear_down()
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>
tests/lib/libsocialweb/backend.vala | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/tests/lib/libsocialweb/backend.vala b/tests/lib/libsocialweb/backend.vala
index 0425278..ce082af 100644
--- a/tests/lib/libsocialweb/backend.vala
+++ b/tests/lib/libsocialweb/backend.vala
@@ -304,6 +304,7 @@ public class LibsocialwebTest.Backend
public bool debug { get; set; }
private LibsocialwebServerTest lsw_server;
+ private uint _name_id = 0;
public signal void ready ();
@@ -325,7 +326,7 @@ public class LibsocialwebTest.Backend
assert_not_reached ();
}
- Bus.own_name (
+ this._name_id = Bus.own_name (
BusType.SESSION, LIBSOCIALWEB_BUS_NAME,
BusNameOwnerFlags.NONE,
on_bus_aquired,
@@ -352,5 +353,10 @@ public class LibsocialwebTest.Backend
public void tear_down ()
{
+ if (this._name_id != 0)
+ {
+ Bus.unown_name (this._name_id);
+ this._name_id = 0;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]