04_initialize_dbus_glib_threading.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From e9d06b56a54dcd399d1d3eaaf62bdacb7e07084d Mon Sep 17 00:00:00 2001
  2. From: Mirco Bauer <meebey@meebey.net>
  3. Date: Sat, 2 Mar 2013 13:44:46 +0100
  4. Subject: [PATCH] Explicitly initialize D-Bus GLib threading
  5. When gconf was switched from orbit to dbus it was no longer thread-safe by
  6. default. This behavior can only get back by explicitly initializing dbus-glib's
  7. threads. This issue affects multi-threaded GConf# users like Banshee leading
  8. them to SEGVs.
  9. For more details see:
  10. https://bugzilla.gnome.org/show_bug.cgi?id=683830
  11. ---
  12. gconf/GConf/Client.cs | 11 +++++++++++
  13. gconf/GConf/gconf-sharp.dll.config.in | 1 +
  14. 2 files changed, 12 insertions(+)
  15. diff --git a/gconf/GConf/Client.cs b/gconf/GConf/Client.cs
  16. index b8cc881..64efc9f 100644
  17. --- a/gconf/GConf/Client.cs
  18. +++ b/gconf/GConf/Client.cs
  19. @@ -31,6 +31,17 @@ namespace GConf
  20. [DllImport("gconf-2")]
  21. static extern IntPtr gconf_client_get_default ();
  22. + [DllImport("dbus-glib-1")]
  23. + static extern void dbus_g_thread_init ();
  24. +
  25. + static Client ()
  26. + {
  27. + // HACK: we have to initialize dbus' threading else GConf with its
  28. + // dbus backend will not be thread safe and SEGVs in our face, see:
  29. + // https://bugzilla.gnome.org/show_bug.cgi?id=683830
  30. + dbus_g_thread_init();
  31. + }
  32. +
  33. public Client ()
  34. {
  35. Initialize ();
  36. diff --git a/gconf/GConf/gconf-sharp.dll.config.in b/gconf/GConf/gconf-sharp.dll.config.in
  37. index 9fb7d15..f20ddae 100644
  38. --- a/gconf/GConf/gconf-sharp.dll.config.in
  39. +++ b/gconf/GConf/gconf-sharp.dll.config.in
  40. @@ -1,3 +1,4 @@
  41. <configuration>
  42. <dllmap dll="gconf-2" target="libgconf-2@LIB_PREFIX@.4@LIB_SUFFIX@"/>
  43. + <dllmap dll="dbus-glib-1" target="libdbus-glib-1@LIB_PREFIX@.2@LIB_SUFFIX@"/>
  44. </configuration>
  45. --
  46. 1.7.10.4