Merge branch '2312-codegen-test-leak-fix' into 'main'

tests: Fix a leak in gdbus-test-codegen test

Closes #2312

See merge request GNOME/glib!2546
This commit is contained in:
Philip Withnall 2022-03-17 15:12:08 +00:00
commit 1756dde873

View File

@ -23,8 +23,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "glib/glib-private.h"
#include "gdbus-tests.h" #include "gdbus-tests.h"
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64
@ -869,7 +867,7 @@ check_bar_proxy (FooiGenBar *proxy,
"s", "a string", "s", "a string",
"o", "/a/path", "o", "/a/path",
"g", "asig", "g", "asig",
"ay", g_variant_new_parsed ("[byte 0x65, 0x67]"), "ay", "eg",
"as", array_of_strings, "as", array_of_strings,
"ao", array_of_objpaths, "ao", array_of_objpaths,
"ag", g_variant_new_parsed ("[@g 'ass', 'git']"), "ag", g_variant_new_parsed ("[@g 'ass', 'git']"),
@ -1304,18 +1302,6 @@ static gpointer
check_proxies_in_thread (gpointer user_data) check_proxies_in_thread (gpointer user_data)
{ {
GMainLoop *loop = user_data; GMainLoop *loop = user_data;
#ifdef _GLIB_ADDRESS_SANITIZER
/* Silence "Not available before 2.38" when using old API */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_test_incomplete ("FIXME: Leaks a GWeakRef, see glib#2312");
G_GNUC_END_IGNORE_DEPRECATIONS
(void) check_thread_proxies;
(void) check_authorize_proxy;
(void) check_bat_proxy;
(void) check_bar_proxy;
#else
GMainContext *thread_context; GMainContext *thread_context;
GMainLoop *thread_loop; GMainLoop *thread_loop;
GError *error; GError *error;
@ -1382,9 +1368,14 @@ check_proxies_in_thread (gpointer user_data)
g_object_unref (thread_proxy_1); g_object_unref (thread_proxy_1);
g_object_unref (thread_proxy_2); g_object_unref (thread_proxy_2);
/* Wait for the proxy signals to all be unsubscribed. */
while (g_main_context_iteration (thread_context, FALSE))
{
/* Nothing needs to be done here */
}
g_main_loop_unref (thread_loop); g_main_loop_unref (thread_loop);
g_main_context_unref (thread_context); g_main_context_unref (thread_context);
#endif
/* this breaks out of the loop in main() (below) */ /* this breaks out of the loop in main() (below) */
g_main_loop_quit (loop); g_main_loop_quit (loop);