tests: Fix a double-close of a GSource in tests

This bug only gets triggered on BSD, because it calls `recv_message()`
with `G_IO_HUP | G_IO_IN`. That takes two code paths in
`recv_message()`, and ends up calling `shutdown_source()` twice. The
second call causes a critical warning.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/jobs/2004192

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2022-05-16 14:11:13 +01:00
parent 6ad8205949
commit 7137591775

View File

@ -96,8 +96,13 @@ read_all (int fd,
static void
shutdown_source (gpointer data)
{
if (g_source_remove (*(guint *) data))
guint *fd_ptr = data;
if (*fd_ptr != 0)
{
g_source_remove (*fd_ptr);
*fd_ptr = 0;
nrunning--;
if (nrunning == 0)
g_main_loop_quit (main_loop);