summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Playfair Cal <daniel.playfair.cal@gmail.com>2018-08-13 05:31:31 +0000
committerDaniel Playfair Cal <daniel.playfair.cal@gmail.com>2018-08-13 05:31:31 +0000
commitda6fdbfc3962fd04cf0cbd20e2b60c56d8f69f36 (patch)
tree2192501a0f1d8c55d37b43028bdd42de475e485a
parent4a73985c3c3153709e5f22a51cd1262c9f647842 (diff)
parent93eb41c020ccd11a8905a0e26e6dda74fff4ea3a (diff)
downloaddconf-da6fdbfc3962fd04cf0cbd20e2b60c56d8f69f36.tar.gz
Merge branch 'gdbus-deadlocks' into 'master'
dconf_gdbus_get_worker_context(): improve GObject deadlock workaround See merge request GNOME/dconf!15
-rw-r--r--gdbus/dconf-gdbus-thread.c21
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);