Trivial backport of !4020 (merged) and !4122 (merged) to glib-2-80
. See the original MRs for details of the fixes.
I wasn’t originally that bothered about backporting !4020 (merged), but it was needed to ensure that !4122 (merged) applied cleanly, and seems harmless enough to backport.
Fixes: #3401 (closed)