From d40ef833e3c2c9a263ba9d8746fdef7ed820a8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 13 Sep 2022 16:29:20 +0200 Subject: [PATCH 1/2] tests/unix-streams: Free the cancelled error on cancelled cancellable Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333 --- gio/tests/unix-streams.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gio/tests/unix-streams.c b/gio/tests/unix-streams.c index 407a67dbd..16cec26a2 100644 --- a/gio/tests/unix-streams.c +++ b/gio/tests/unix-streams.c @@ -147,6 +147,7 @@ main_thread_skipped (GObject *source, GAsyncResult *res, gpointer user_data) if (g_cancellable_is_cancelled (main_cancel)) { do_main_cancel (out); + g_clear_error (&err); return; } From c8e2d4a38dc36c44e7daec8056538dd35ee3c9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 13 Sep 2022 16:30:12 +0200 Subject: [PATCH 2/2] unix-streams: Ensure we get cancelled errors if the cancellable is cancelled --- gio/tests/unix-streams.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gio/tests/unix-streams.c b/gio/tests/unix-streams.c index 16cec26a2..e32e2861d 100644 --- a/gio/tests/unix-streams.c +++ b/gio/tests/unix-streams.c @@ -146,6 +146,7 @@ main_thread_skipped (GObject *source, GAsyncResult *res, gpointer user_data) if (g_cancellable_is_cancelled (main_cancel)) { + g_assert_error (err, G_IO_ERROR, G_IO_ERROR_CANCELLED); do_main_cancel (out); g_clear_error (&err); return; @@ -181,6 +182,7 @@ main_thread_read (GObject *source, GAsyncResult *res, gpointer user_data) if (g_cancellable_is_cancelled (main_cancel)) { + g_assert_error (err, G_IO_ERROR, G_IO_ERROR_CANCELLED); do_main_cancel (out); g_clear_error (&err); return; @@ -218,6 +220,7 @@ main_thread_wrote (GObject *source, GAsyncResult *res, gpointer user_data) if (g_cancellable_is_cancelled (main_cancel)) { + g_assert_error (err, G_IO_ERROR, G_IO_ERROR_CANCELLED); do_main_cancel (out); g_clear_error (&err); return;