[Banshee-devel-list] PATCH: fix for non-responsive GUI when searching



Hello all,

I'm really sick of the gui hanging when I do searches.  I have about
23 thousand songs and I usually have to kill Banshee because it takes
several minutes before it becomes responsive again.  It typically
hangs if I only get a letter or two entered before it tries to search.
I guess it gets choked up since there is so much to search and so
many matches.

Here is the bug for it: http://bugzilla.gnome.org/show_bug.cgi?id=351315

I'm looking for feedback on my approach.  I attached a quick patch
which is far from finished, but can be tested to see the effect.
Basically, I start a new thread each time a search is fired off.  The
thread saves a time stamp for the start time and creates an array of
TrackInfo objects.  Then the code checks to see if there was an update
that has already occurred that superseded the current thread.  If it
has been superseded, I discard the array.  Otherwise, I clear the
playlist model, add the tracks to it, and then update the playlist
view.

Here are some issues that I see:

- When switching from my library to a playlist, the playlist is blank.
If I switch to another playlist and then back to the first playlist,
the tracks show up.  Not sure what is happening here.  It's probably
something simple.

- I think it would be good to kill superseded threads to limit cpu
usage.  That way there won't be several search worker threads running.
Only the latest will complete.  So when a new search is fired off, we
could have a thread manager of sorts that can search through the
search threads and kill off the superseded threads.  I believe we
already have a thread manager, but I'm not that familiar with it.

- I removed a block of code that didn't appear to be necessary.  Do we
really need this block of code?  Before this block the playlist model
use to be cleared.  I just modified it so that the check if the query
is made before the model is cleared.

          if(!searchEntry.IsQueryAvailable) {
              playlistModel.ReloadSource();
              while(Application.EventsPending()) {
                  Application.RunIteration();
              }
              playlistView.UpdateView();
              return;
          }

Please take 10 minutes to look over the patch and rip it apart.  The
more feedback the better.

-- Trey



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