mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
tests: Add more debug output to gdbus-threading test
It periodically hangs due to the `GDBusConnection` having more than 1 ref (and never losing them), so there’s potentially a leaking ref somewhere: ``` (/builds/alexander.klauer/glib/_build/gio/tests/gdbus-threading:17767): GLib-GIO-DEBUG: 13:18:12.268: refcount of 0x55fe85b1a260 is not right, sleeping \# GLib-GIO-DEBUG: refcount of 0x55fe85b1a260 is not right, sleeping ``` Add some more debug output to try and track the problem down. See: https://gitlab.gnome.org/alexander.klauer/glib/-/jobs/1865968 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
54ee8e5414
commit
4d237daf32
@ -48,8 +48,9 @@ timeout_cb (gpointer user_data)
|
||||
* unrefs complete first. This is typically used on the shared connection, to
|
||||
* ensure it’s in a correct state before beginning the next test. */
|
||||
static void
|
||||
assert_connection_has_one_ref (GDBusConnection *connection,
|
||||
GMainContext *context)
|
||||
(assert_connection_has_one_ref) (GDBusConnection *connection,
|
||||
GMainContext *context,
|
||||
const gchar *calling_function)
|
||||
{
|
||||
GSource *timeout_source = NULL;
|
||||
TimeoutData data = { context, FALSE };
|
||||
@ -63,7 +64,8 @@ assert_connection_has_one_ref (GDBusConnection *connection,
|
||||
|
||||
while (g_atomic_int_get (&G_OBJECT (connection)->ref_count) != 1 && !data.timed_out)
|
||||
{
|
||||
g_debug ("refcount of %p is not right, sleeping", connection);
|
||||
g_debug ("refcount of %p is not right (%u rather than 1) in %s(), sleeping",
|
||||
connection, g_atomic_int_get (&G_OBJECT (connection)->ref_count), calling_function);
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
}
|
||||
|
||||
@ -71,9 +73,14 @@ assert_connection_has_one_ref (GDBusConnection *connection,
|
||||
g_source_unref (timeout_source);
|
||||
|
||||
if (g_atomic_int_get (&G_OBJECT (connection)->ref_count) != 1)
|
||||
g_error ("connection %p had too many refs", connection);
|
||||
g_error ("connection %p had too many refs (%u rather than 1) in %s()",
|
||||
connection, g_atomic_int_get (&G_OBJECT (connection)->ref_count), calling_function);
|
||||
}
|
||||
|
||||
/* Macro wrapper to add in the calling function name */
|
||||
#define assert_connection_has_one_ref(connection, context) \
|
||||
(assert_connection_has_one_ref) (connection, context, G_STRFUNC)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
/* Ensure that signal and method replies are delivered in the right thread */
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user