[glib: 1/6] gio/tests/gdbus-proxy-threads: Unref GVariant's that we own
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/6] gio/tests/gdbus-proxy-threads: Unref GVariant's that we own
- Date: Fri, 2 Sep 2022 20:12:51 +0000 (UTC)
commit 1da208cddc19cad05ccf4b798a99f7045e41ffc4
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Fri Sep 2 20:26:06 2022 +0200
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
gio/tests/gdbus-proxy-threads.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/gdbus-proxy-threads.c b/gio/tests/gdbus-proxy-threads.c
index 76b857e731..a0a38d07cd 100644
--- a/gio/tests/gdbus-proxy-threads.c
+++ b/gio/tests/gdbus-proxy-threads.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]