banshee r4479 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources



Author: gburt
Date: Sun Sep  7 00:39:37 2008
New Revision: 4479
URL: http://svn.gnome.org/viewvc/banshee?rev=4479&view=rev

Log:
2008-09-06  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.Services/Banshee.Sources/Source.cs: Fix deadlock hang
	triggered by Last.fm (BGO #551175).



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs	Sun Sep  7 00:39:37 2008
@@ -170,36 +170,32 @@
         
         public virtual void AddChildSource (Source child)
         {
-            ThreadAssist.ProxyToMain (delegate {
-                lock (Children) {
-                    if (!child_sources.Contains (child)) {
-                        child.SetParentSource (this);
-                        child_sources.Add (child);
-                        OnChildSourceAdded (child);
-                    }
+            lock (Children) {
+                if (!child_sources.Contains (child)) {
+                    child.SetParentSource (this);
+                    child_sources.Add (child);
+                    OnChildSourceAdded (child);
                 }
-            });
+            }
         }
 
         public virtual void RemoveChildSource (Source child)
         {
-            ThreadAssist.ProxyToMain (delegate {
-                lock (Children) {
-                    if (child.Children.Count > 0) {
-                        child.ClearChildSources ();
-                    }
-                    
-                    child_sources.Remove (child);
-                    
-                    if (ServiceManager.SourceManager.ActiveSource == child) {
-                        if (CanActivate) {
-                            ServiceManager.SourceManager.SetActiveSource (this);
-                        }
+            lock (Children) {
+                if (child.Children.Count > 0) {
+                    child.ClearChildSources ();
+                }
+                
+                child_sources.Remove (child);
+                
+                if (ServiceManager.SourceManager.ActiveSource == child) {
+                    if (CanActivate) {
+                        ServiceManager.SourceManager.SetActiveSource (this);
                     }
-                    
-                    OnChildSourceRemoved (child);
                 }
-            });
+                
+                OnChildSourceRemoved (child);
+            }
         }
         
         public virtual void ClearChildSources ()
@@ -396,22 +392,26 @@
     
         protected virtual void OnChildSourceAdded (Source source)
         {
-            SourceEventHandler handler = ChildSourceAdded;
-            if (handler != null) {
-                SourceEventArgs args = new SourceEventArgs ();
-                args.Source = source;
-                handler (args);
-            }
+            ThreadAssist.ProxyToMain (delegate {
+                SourceEventHandler handler = ChildSourceAdded;
+                if (handler != null) {
+                    SourceEventArgs args = new SourceEventArgs ();
+                    args.Source = source;
+                    handler (args);
+                }
+            });
         }
         
         protected virtual void OnChildSourceRemoved (Source source)
         {
-            SourceEventHandler handler = ChildSourceRemoved;
-            if (handler != null) {
-                SourceEventArgs args = new SourceEventArgs ();
-                args.Source = source;
-                handler (args);
-            }
+            ThreadAssist.ProxyToMain (delegate {
+                SourceEventHandler handler = ChildSourceRemoved;
+                if (handler != null) {
+                    SourceEventArgs args = new SourceEventArgs ();
+                    args.Source = source;
+                    handler (args);
+                }
+            });
         }
         
         protected virtual void OnUpdated ()



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