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>
This commit is contained in:
Philip Withnall 2022-02-18 02:34:25 +00:00
parent ba556e6d34
commit 2bc1036f80

View File

@ -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;