This is a backport of !277 (merged) to glib-2-58. Trivial cherry-pick with no merge conflicts.
glib-2-58