[glib: 9/10] tests: Fix a memory leak in the mainloop test
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 9/10] tests: Fix a memory leak in the mainloop test
- Date: Sun, 20 Feb 2022 12:09:02 +0000 (UTC)
commit 2bc1036f8050c5553484dd92f37a88b672875807
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Feb 18 02:34:25 2022 +0000
tests: Fix a memory leak in the mainloop test
The source needs to be removed from the `GMainContext` before being
unreffed, otherwise the main context and main loop will be kept around.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
glib/tests/mainloop.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index 25ef4f42e..8141010c8 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -1687,10 +1687,11 @@ threadf (gpointer data)
source = g_timeout_source_new (250);
g_source_set_callback (source, timeout_cb, loop, NULL);
g_source_attach (source, context);
- g_source_unref (source);
g_main_loop_run (loop);
+ g_source_destroy (source);
+ g_source_unref (source);
g_main_loop_unref (loop);
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]