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



Author: abock
Date: Mon Mar 10 23:29:10 2008
New Revision: 3405
URL: http://svn.gnome.org/viewvc/banshee?rev=3405&view=rev

Log:
2008-03-10  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs: Removed all
    of the excessive [potential] thread spawning; it will be moved to where
    it is actually necessary (it is not necessary in most cases, is overkill,
    and can cause unexpected problems); this fixes the regression in the
    Play Queue



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

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs	Mon Mar 10 23:29:10 2008
@@ -142,14 +142,12 @@
 
         protected virtual void RateLimitedReload ()
         {
-            ThreadAssist.SpawnFromMain (delegate {
-                lock (track_model) {
-                    ReloadTrackModel ();
-                    artist_model.Reload ();
-                    album_model.Reload ();
-                    OnUpdated ();
-                }
-            });
+            lock (track_model) {
+                ReloadTrackModel ();
+                artist_model.Reload ();
+                album_model.Reload ();
+                OnUpdated ();
+            }
         }
 
         protected virtual void ReloadTrackModel ()
@@ -160,33 +158,33 @@
         protected void ReloadTrackModel (bool notify)
         {
             track_model.Reload (notify);
+            Hyena.Log.DebugFormat ("Called {0}::ReloadTrackModel ({1}) [Count={2}]", GetType ().FullName, 
+                notify, track_model.Count);
         }
 
         protected virtual void RateLimitedFilter ()
         {
-            ThreadAssist.SpawnFromMain (delegate {
-                lock (this) {
-                    // First, reload the track model w/o the artist/album filter
-                    track_model.SuppressReloads = true;
-                    track_model.Filter = FilterQuery;
-                    track_model.ClearArtistAlbumFilters ();
-                    track_model.SuppressReloads = false;
-                    ReloadTrackModel (false);
-
-                    // Then, reload the artist/album models
-                    artist_model.Reload ();
-                    album_model.Reload ();
-
-                    // Then, reload the track model with the artist/album filters
-                    track_model.SuppressReloads = true;
-                    track_model.ArtistInfoFilter = artist_model.SelectedItems;
-                    track_model.AlbumInfoFilter = album_model.SelectedItems;
-                    track_model.SuppressReloads = false;
-                    ReloadTrackModel ();
+            lock (this) {
+                // First, reload the track model w/o the artist/album filter
+                track_model.SuppressReloads = true;
+                track_model.Filter = FilterQuery;
+                track_model.ClearArtistAlbumFilters ();
+                track_model.SuppressReloads = false;
+                ReloadTrackModel (false);
+
+                // Then, reload the artist/album models
+                artist_model.Reload ();
+                album_model.Reload ();
+
+                // Then, reload the track model with the artist/album filters
+                track_model.SuppressReloads = true;
+                track_model.ArtistInfoFilter = artist_model.SelectedItems;
+                track_model.AlbumInfoFilter = album_model.SelectedItems;
+                track_model.SuppressReloads = false;
+                ReloadTrackModel ();
 
-                    OnUpdated ();
-                }
-            });
+                OnUpdated ();
+            }
         }
 
         /*protected virtual void ReloadChildren ()
@@ -264,12 +262,10 @@
 
         protected virtual void OnTracksAdded ()
         {
-            ThreadAssist.SpawnFromMain (delegate {
-                HandleTracksAdded (this, new TrackEventArgs ());
-                foreach (PrimarySource psource in PrimarySources) {
-                    psource.NotifyTracksAdded ();
-                }
-            });
+            HandleTracksAdded (this, new TrackEventArgs ());
+            foreach (PrimarySource psource in PrimarySources) {
+                psource.NotifyTracksAdded ();
+            }
         }
 
         protected void OnTracksChanged ()
@@ -279,22 +275,18 @@
 
         protected virtual void OnTracksChanged (QueryField field)
         {
-            ThreadAssist.SpawnFromMain (delegate {
-                HandleTracksChanged (this, new TrackEventArgs (field));
-                foreach (PrimarySource psource in PrimarySources) {
-                    psource.NotifyTracksChanged (field);
-                }
-            });
+            HandleTracksChanged (this, new TrackEventArgs (field));
+            foreach (PrimarySource psource in PrimarySources) {
+                psource.NotifyTracksChanged (field);
+            }
         }
 
         protected virtual void OnTracksDeleted ()
         {
-            ThreadAssist.SpawnFromMain (delegate {
-                HandleTracksDeleted (this, new TrackEventArgs ());
-                foreach (PrimarySource psource in PrimarySources) {
-                    psource.NotifyTracksDeleted ();
-                }
-            });
+            HandleTracksDeleted (this, new TrackEventArgs ());
+            foreach (PrimarySource psource in PrimarySources) {
+                psource.NotifyTracksDeleted ();
+            }
         }
 
         protected virtual void OnTracksRemoved ()



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