[glib] GDBusConnection: Fix race in /gdbus/connection/life-cycle
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GDBusConnection: Fix race in /gdbus/connection/life-cycle
- Date: Tue, 18 Oct 2011 12:35:20 +0000 (UTC)
commit f07201c314e891354f236d7ec49a11700ce02da0
Author: Sjoerd Simons <sjoerd luon net>
Date: Sun Oct 16 10:57:29 2011 +0100
GDBusConnection: Fix race in /gdbus/connection/life-cycle
GDBusConnection sets the closed flag in the worker thread, then adds an
idle callback (which refs the Connection) to signal this in the main
thread. The tests session_bus_down doesn't spin the mainloop, so the
"closed" signal will always fire if iterating the mainloop later (and
drops the ref when doing so). But _is_closed can return TRUE even before
signalling this, in which case the "closed" signal isn't fired and the
ref isn't dropped, causing the test to fail.
Instead simply always wait for the closed signal, which is a good thing
to check anyway and ensures the ref is closed.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661896
Reviewed-by: Matthias Clasen <mclasen redhat com>
gio/tests/gdbus-connection.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/gdbus-connection.c b/gio/tests/gdbus-connection.c
index a88df90..073ff9e 100644
--- a/gio/tests/gdbus-connection.c
+++ b/gio/tests/gdbus-connection.c
@@ -264,8 +264,7 @@ test_connection_life_cycle (void)
g_assert (!g_dbus_connection_is_closed (c));
g_dbus_connection_set_exit_on_close (c, FALSE);
session_bus_down ();
- if (!g_dbus_connection_is_closed (c))
- _g_assert_signal_received (c, "closed");
+ _g_assert_signal_received (c, "closed");
g_assert (g_dbus_connection_is_closed (c));
_g_object_wait_for_single_ref (c);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]