File banshee-avoid-dbus-race.patch of Package banshee

From 459be46e3bd086deba369f367e6198d0b25f1a7c Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj@cl.no>
Date: Tue, 26 Feb 2013 02:43:37 +0100
Subject: [PATCH] Avoid race when using GConf and DBus with threads

GConf causes us to make indirect calls to libdbus from multiple threads,
resulting in crashes if left uninitialized. As a workaround, we initialize
dbus-glib for multithreading.
---
 .../Banshee.Gui/GtkBaseClient.cs                   |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
index c5c5675..1df06ad 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
@@ -28,6 +28,7 @@
 
 using System;
 using System.IO;
+using System.Runtime.InteropServices;
 
 using Mono.Addins;
 
@@ -100,6 +101,10 @@ namespace Banshee.Gui
         {
         }
 
+        internal const string LIBDBUSGLIB1 = "libdbus-glib-1.so.2";
+        [DllImport (LIBDBUSGLIB1, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+        internal static extern void dbus_g_thread_init ();
+
         protected virtual void InitializeGtk ()
         {
             Log.Debug ("Initializing GTK");
@@ -107,6 +112,9 @@ namespace Banshee.Gui
             if (!GLib.Thread.Supported) {
                 GLib.Thread.Init ();
             }
+
+            dbus_g_thread_init ();
+
             Gtk.Application.Init ();
 
             if (ApplicationContext.CommandLine.Contains ("debug-gtkrc")) {
-- 
1.7.7
openSUSE Build Service is sponsored by