gio/tests/gdbus-proxy-threads: Unref GVariant's that we own

This test is leaking various GVariant's that we are supposed to unref,
leading the valgrind CI job to complain about.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
This commit is contained in:
Marco Trevisan (Treviño) 2022-09-02 20:26:06 +02:00
parent 88d4b3b365
commit 1da208cddc

View File

@ -119,13 +119,17 @@ request_name_cb (GObject *source,
GDBusConnection *connection = G_DBUS_CONNECTION (source);
GError *error = NULL;
GVariant *var;
GVariant *child;
var = g_dbus_connection_call_finish (connection, res, &error);
g_assert_no_error (error);
g_assert_cmpuint (g_variant_get_uint32 (g_variant_get_child_value (var, 0)),
child = g_variant_get_child_value (var, 0);
g_assert_cmpuint (g_variant_get_uint32 (child),
==, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
release_name (connection, TRUE);
g_variant_unref (child);
g_variant_unref (var);
}
static void
@ -154,11 +158,13 @@ release_name_cb (GObject *source,
GDBusConnection *connection = G_DBUS_CONNECTION (source);
GError *error = NULL;
GVariant *var;
GVariant *child;
int i;
var = g_dbus_connection_call_finish (connection, res, &error);
g_assert_no_error (error);
g_assert_cmpuint (g_variant_get_uint32 (g_variant_get_child_value (var, 0)),
child = g_variant_get_child_value (var, 0);
g_assert_cmpuint (g_variant_get_uint32 (child),
==, DBUS_RELEASE_NAME_REPLY_RELEASED);
/* generate some rapid NameOwnerChanged signals to try to trigger crashes */
@ -170,6 +176,8 @@ release_name_cb (GObject *source,
/* wait for dbus-daemon to catch up */
request_name (connection, TRUE);
g_variant_unref (child);
g_variant_unref (var);
}
static void