mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
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:
parent
88d4b3b365
commit
1da208cddc
@ -119,13 +119,17 @@ request_name_cb (GObject *source,
|
|||||||
GDBusConnection *connection = G_DBUS_CONNECTION (source);
|
GDBusConnection *connection = G_DBUS_CONNECTION (source);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *var;
|
GVariant *var;
|
||||||
|
GVariant *child;
|
||||||
|
|
||||||
var = g_dbus_connection_call_finish (connection, res, &error);
|
var = g_dbus_connection_call_finish (connection, res, &error);
|
||||||
g_assert_no_error (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);
|
==, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
|
||||||
|
|
||||||
release_name (connection, TRUE);
|
release_name (connection, TRUE);
|
||||||
|
g_variant_unref (child);
|
||||||
|
g_variant_unref (var);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -154,11 +158,13 @@ release_name_cb (GObject *source,
|
|||||||
GDBusConnection *connection = G_DBUS_CONNECTION (source);
|
GDBusConnection *connection = G_DBUS_CONNECTION (source);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *var;
|
GVariant *var;
|
||||||
|
GVariant *child;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
var = g_dbus_connection_call_finish (connection, res, &error);
|
var = g_dbus_connection_call_finish (connection, res, &error);
|
||||||
g_assert_no_error (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);
|
==, DBUS_RELEASE_NAME_REPLY_RELEASED);
|
||||||
|
|
||||||
/* generate some rapid NameOwnerChanged signals to try to trigger crashes */
|
/* 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 */
|
/* wait for dbus-daemon to catch up */
|
||||||
request_name (connection, TRUE);
|
request_name (connection, TRUE);
|
||||||
|
g_variant_unref (child);
|
||||||
|
g_variant_unref (var);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user