mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gdbus-proxy test: Wait before asserting name owner has gone away
GDBusConnection sends each signal to recipients in a separate idle
callback, and there's no particular guarantee about the order in which
they're scheduled or dispatched. For the NameOwnerChanged signal that
reports the name becoming unowned, it's possible that g_bus_watch_name()
gets its idle callback called before the GDBusProxy:g-name-owner
machinery has updated the name owner, in which case the assertion
will fail.
Fixing GNOME/glib#3268 introduced a new subscription to NameOwnerChanged
which can alter the order of delivery, particularly in the case where
G_DBUS_PROXY_FLAGS_NO_MATCH_RULE was used (as tested in
/gdbus/proxy/no-match-rule). The resulting test failure is intermittent,
but reliably appears within 100 repetitions of that test.
Fixes: 511c5f5b
"tests: Wait for gdbus-testserver to die when killing it"
Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
parent
c7caf98646
commit
7b15b1db40
@ -780,6 +780,12 @@ kill_test_service (GDBusConnection *connection)
|
||||
while (!name_disappeared)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
/* GDBusConnection doesn't guarantee that different subscriptions to the
|
||||
* same signal will get their callbacks scheduled in any particular order,
|
||||
* so make sure they have all happened */
|
||||
while (g_main_context_iteration (NULL, FALSE))
|
||||
continue;
|
||||
|
||||
g_bus_unwatch_name (watch_id);
|
||||
#else
|
||||
g_warning ("Can't kill com.example.TestService");
|
||||
|
Loading…
Reference in New Issue
Block a user