src: ensure GSource background unref happens in correct event loop

The g_idle_add function adds a callback to the primary GMainContext.

To workaround the GSource unref bugs, we need to add our callbacks
to the GMainContext that is associated with the GSource being
unref'd. Thus code using the per-VM virEventThread must use its
private GMainContext.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2021-03-16 16:26:06 +00:00
parent 78bcf5546b
commit 695bdb3841
9 changed files with 28 additions and 41 deletions

View File

@@ -1049,9 +1049,6 @@ if host_machine.system() == 'windows'
else
gio_dep = dependency('gio-unix-2.0', version: '>=' + glib_version)
endif
# GLib event loop race workaround in glibcompat.h, remove when minimum required
# glib is >= 2.64.0
glib_crash_workaround = glib_dep.version().version_compare('<2.64.0')
glib_dep = declare_dependency(
dependencies: [ glib_dep, gobject_dep, gio_dep ],
)