diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2018-08-12 15:26:01 +0200 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2018-08-13 07:24:24 +0200 |
commit | 93eb41c020ccd11a8905a0e26e6dda74fff4ea3a (patch) | |
tree | e9ac97902b8f7dc120a93cc6dca0647a81935298 /gdbus | |
parent | 35ceabc78bdc09645ca44413243e98199982d2ce (diff) | |
download | dconf-93eb41c020ccd11a8905a0e26e6dda74fff4ea3a.tar.gz |
dconf_gdbus_get_worker_context(): improve GObject deadlock workaround
The existing workaround for
https://bugzilla.gnome.org/show_bug.cgi?id=674885
doesn't go far enough, and deadlocks can occur, for example, with the
GSocket type. Extend the workaround logic to all the types from
glib/gio/gdbusprivate.c:ensure_required_types().
Diffstat (limited to 'gdbus')
-rw-r--r-- | gdbus/dconf-gdbus-thread.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gdbus/dconf-gdbus-thread.c b/gdbus/dconf-gdbus-thread.c index 8ed28b5..8b8f048 100644 --- a/gdbus/dconf-gdbus-thread.c +++ b/gdbus/dconf-gdbus-thread.c @@ -94,9 +94,28 @@ dconf_gdbus_get_worker_context (void) { GMainContext *context; - /* Work around https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ + /* Work around https://bugzilla.gnome.org/show_bug.cgi?id=674885 + * + * This set of types is the same as the set in + * glib/gio/gdbusprivate.c:ensure_required_types(). That workaround + * is ineffective for us since we're already in the worker thread when + * we call g_bus_get_sync() and ensure_required_types() runs. So we do + * something similar here before launching the worker thread. Calling + * g_bus_get_sync() here would also be possible, but potentially would + * cause significant startup latency for every dconf user. + */ + g_type_ensure (G_TYPE_TASK); + g_type_ensure (G_TYPE_MEMORY_INPUT_STREAM); + g_type_ensure (G_TYPE_DBUS_CONNECTION_FLAGS); + g_type_ensure (G_TYPE_DBUS_CAPABILITY_FLAGS); + g_type_ensure (G_TYPE_DBUS_AUTH_OBSERVER); g_type_ensure (G_TYPE_DBUS_CONNECTION); g_type_ensure (G_TYPE_DBUS_PROXY); + g_type_ensure (G_TYPE_SOCKET_FAMILY); + g_type_ensure (G_TYPE_SOCKET_TYPE); + g_type_ensure (G_TYPE_SOCKET_PROTOCOL); + g_type_ensure (G_TYPE_SOCKET_ADDRESS); + g_type_ensure (G_TYPE_SOCKET); context = g_main_context_new (); g_thread_new ("dconf worker", dconf_gdbus_worker_thread, context); |