• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 1da208cddc19cad05ccf4b798a99f7045e41ffc4 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
3Date: Fri, 2 Sep 2022 20:26:06 +0200
4Subject: [PATCH] gio/tests/gdbus-proxy-threads: Unref GVariant's that we own
5
6This test is leaking various GVariant's that we are supposed to unref,
7leading the valgrind CI job to complain about.
8
9Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
10
11Conflict:NA
12Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/1da208cddc19cad05ccf4b798a99f7045e41ffc4
13
14---
15 gio/tests/gdbus-proxy-threads.c | 12 ++++++++++--
16 1 file changed, 10 insertions(+), 2 deletions(-)
17
18diff --git a/gio/tests/gdbus-proxy-threads.c b/gio/tests/gdbus-proxy-threads.c
19index 76b857e731..a0a38d07cd 100644
20--- a/gio/tests/gdbus-proxy-threads.c
21+++ b/gio/tests/gdbus-proxy-threads.c
22@@ -119,13 +119,17 @@ request_name_cb (GObject *source,
23   GDBusConnection *connection = G_DBUS_CONNECTION (source);
24   GError *error = NULL;
25   GVariant *var;
26+  GVariant *child;
27
28   var = g_dbus_connection_call_finish (connection, res, &error);
29   g_assert_no_error (error);
30-  g_assert_cmpuint (g_variant_get_uint32 (g_variant_get_child_value (var, 0)),
31+  child = g_variant_get_child_value (var, 0);
32+  g_assert_cmpuint (g_variant_get_uint32 (child),
33                     ==, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
34
35   release_name (connection, TRUE);
36+  g_variant_unref (child);
37+  g_variant_unref (var);
38 }
39
40 static void
41@@ -154,11 +158,13 @@ release_name_cb (GObject *source,
42   GDBusConnection *connection = G_DBUS_CONNECTION (source);
43   GError *error = NULL;
44   GVariant *var;
45+  GVariant *child;
46   int i;
47
48   var = g_dbus_connection_call_finish (connection, res, &error);
49   g_assert_no_error (error);
50-  g_assert_cmpuint (g_variant_get_uint32 (g_variant_get_child_value (var, 0)),
51+  child = g_variant_get_child_value (var, 0);
52+  g_assert_cmpuint (g_variant_get_uint32 (child),
53                     ==, DBUS_RELEASE_NAME_REPLY_RELEASED);
54
55   /* generate some rapid NameOwnerChanged signals to try to trigger crashes */
56@@ -170,6 +176,8 @@ release_name_cb (GObject *source,
57
58   /* wait for dbus-daemon to catch up */
59   request_name (connection, TRUE);
60+  g_variant_unref (child);
61+  g_variant_unref (var);
62 }
63
64 static void
65--
66GitLab
67
68