[glib/glib-2-52] gdbus: Initialize types earlier to break proxy <-> connection deadlock
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-52] gdbus: Initialize types earlier to break proxy <-> connection deadlock
- Date: Sat, 8 Apr 2017 05:49:29 +0000 (UTC)
commit 4367515d0674c476c74c740248955456a0bad695
Author: Colin Walters <walters verbum org>
Date: Fri Nov 18 16:26:58 2016 -0500
gdbus: Initialize types earlier to break proxy <-> connection deadlock
This will help us break generic GType deadlocks between people using
GDBus in different threads (which is supported), not just by GType
usage in the GDBus thread.
This should fix the common cases we're seeing in the wild, although I
have some lingering concerns that if someone e.g. referenced
e.g. `G_TYPE_DBUS_AUTH_MECHANISM_SHA1` etc. we'd need to add those
too.
https://bugzilla.gnome.org/show_bug.cgi?id=674885
gio/gdbusprivate.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index ea05dcd..eeb12d9 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -202,7 +202,8 @@ _g_socket_read_with_control_messages_finish (GSocket *socket,
/* ---------------------------------------------------------------------------------------------------- */
-/* Work-around for https://bugzilla.gnome.org/show_bug.cgi?id=627724 */
+/* Work-around for https://bugzilla.gnome.org/show_bug.cgi?id=674885
+ and see also the original https://bugzilla.gnome.org/show_bug.cgi?id=627724 */
static GPtrArray *ensured_classes = NULL;
@@ -227,6 +228,8 @@ ensure_required_types (void)
ensured_classes = g_ptr_array_new ();
ensure_type (G_TYPE_TASK);
ensure_type (G_TYPE_MEMORY_INPUT_STREAM);
+ ensure_type (G_TYPE_DBUS_CONNECTION);
+ ensure_type (G_TYPE_DBUS_PROXY);
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -264,9 +267,6 @@ _g_dbus_shared_thread_ref (void)
{
SharedThreadData *data;
- /* Work-around for https://bugzilla.gnome.org/show_bug.cgi?id=627724 */
- ensure_required_types ();
-
data = g_new0 (SharedThreadData, 1);
data->refcount = 0;
@@ -1921,6 +1921,9 @@ _g_dbus_initialize (void)
_gdbus_debug_flags |= G_DBUS_DEBUG_MESSAGE;
}
+ /* Work-around for https://bugzilla.gnome.org/show_bug.cgi?id=627724 */
+ ensure_required_types ();
+
g_once_init_leave (&initialized, 1);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]