tests: Fix intermittent failure in GCancellableSource test

It seems that allowing the GCancellable to be finalised in either the main thread or the worker thread sometimes leads to crashes when running on CI.

I cannot reproduce these crashes locally, and various analyses with memcheck, drd and helgrind have failed to give any clues.

Fix this for this particular test case by deferring destruction of the GCancellable instances until after the worker thread has joined. That’s OK because this test is specifically checking a race between g_cancellable_cancel() and disposal of a GCancellableSource.

The underlying bug remains unfixed, though, and I can only hope that we eventually find a reliable way of reproducing it so it can be analysed and fixed.

Signed-off-by: Philip Withnall withnall@endlessm.com

Also contains a tacked-on fix for #1764 (closed).

Closes: #1764 (closed)

Merge request reports