banshee r4369 - in trunk/banshee: . src/Dap/Banshee.Dap/Banshee.Dap



Author: gburt
Date: Thu Aug 14 20:51:28 2008
New Revision: 4369
URL: http://svn.gnome.org/viewvc/banshee?rev=4369&view=rev

Log:
2008-08-14  Gabriel Burt  <gabriel burt gmail com>

	* src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs: Lock on private object,
	not this to avoid deadlock with external code locking on this.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs

Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs	Thu Aug 14 20:51:28 2008
@@ -48,6 +48,7 @@
         private Dictionary<string, DapSource> sources;
         private List<TypeExtensionNode> supported_dap_types = new List<TypeExtensionNode> ();
         private bool initialized;
+        private object sync = new object ();
 
         public void Initialize ()
         {
@@ -55,7 +56,7 @@
 
         public void DelayedInitialize ()
         {
-            lock (this) {
+            lock (sync) {
                 sources = new Dictionary<string, DapSource> ();
                 
                 AddinManager.AddExtensionNodeHandler ("/Banshee/Dap/DeviceClass", OnExtensionChanged);
@@ -69,7 +70,7 @@
 
         private void OnExtensionChanged (object o, ExtensionNodeEventArgs args) 
         {
-            lock (this) {
+            lock (sync) {
                 TypeExtensionNode node = (TypeExtensionNode)args.ExtensionNode;
                 
                 if (args.Change == ExtensionChange.Add) {
@@ -99,7 +100,7 @@
 
         public void Dispose ()
         {
-            lock (this) {
+            lock (sync) {
                 if (!initialized)
                     return;
 
@@ -142,7 +143,7 @@
         private void MapDevice (IDevice device)
         {
             Banshee.Kernel.Scheduler.Schedule (new Banshee.Kernel.DelegateJob (delegate {
-                lock (this) {
+                lock (sync) {
                     try {
                         if (sources.ContainsKey (device.Uuid)) {
                             return;
@@ -176,7 +177,7 @@
         
         internal void UnmapDevice (string uuid)
         {
-            lock (this) {
+            lock (sync) {
                 if (sources.ContainsKey (uuid)) {
                     Log.DebugFormat ("Unmapping DAP source ({0})", uuid);
                     DapSource source = sources[uuid];
@@ -191,7 +192,7 @@
         {
             DapSource dap_source = args.Source as DapSource;
             if (dap_source != null) {
-                lock (this) {
+                lock (sync) {
                     UnmapDevice (dap_source.Device.Uuid);
                 }
             }
@@ -199,14 +200,14 @@
         
         private void OnHardwareDeviceAdded (object o, DeviceAddedArgs args)
         {
-            lock (this) {
+            lock (sync) {
                 MapDevice (args.Device);
             }
         }
         
         private void OnHardwareDeviceRemoved (object o, DeviceRemovedArgs args)
         {
-            lock (this) {
+            lock (sync) {
                 UnmapDevice (args.DeviceUuid);
             }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]