Bug 195399 - Automatically scroll sometimes centers on the previous track
Summary: Automatically scroll sometimes centers on the previous track
Status: RESOLVED DUPLICATE of bug 193459
Alias: None
Product: amarok
Classification: Applications
Component: Playlist (show other bugs)
Version: 2.1
Platform: Ubuntu Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-06 02:19 UTC by Anthony Vital
Modified: 2009-08-22 02:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch EngineObserver.h (558 bytes, patch)
2009-08-21 18:14 UTC, Anthony Vital
Details
patch EngineObserver.cpp (484 bytes, patch)
2009-08-21 18:16 UTC, Anthony Vital
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Vital 2009-06-06 02:19:53 UTC
Version:           2.1 (using KDE 4.2.2)
Compiler:          g++ 4.3.3 cmake 2.6-patch 2 , Qt 4.5.0
OS:                Linux
Installed from:    Ubuntu Packages

Sometimes, the automatic scrolling centers on the previous track instead of the current one. This always happens -if it happens- at amarok start up. I mean, either everything  works fine as long as amarok is not quit, either the problem appears on the first track I want to play and stays until amarok is quit.
If the wrong track (let's say "track A") is centered, I can click on the "display current track" button, it works fine, "track B" (the good one) is centered. But when amarok goes to the next one ("track C") (skip button or end of the song), then "track B" is centered instead of "track C" and so on...
It's a weird one, as I can't figure out a reliable pattern to reproduce it. But it actually happens quite often on my system, about 50% of the time.
Comment 1 Gary Steinert 2009-06-06 15:27:04 UTC
Confirmed in latest svn. Perhaps the playlist is being centred before amarok has chance to start playing the next track?

Gary
Comment 2 Myriam Schweingruber 2009-07-14 09:47:32 UTC
Playlist scrolling seems to be broken in general, I set those various playlist scrolling bug reports as duplicates.

*** This bug has been marked as a duplicate of bug 193459 ***
Comment 3 Anthony Vital 2009-08-21 18:14:28 UTC
Created attachment 36334 [details]
patch EngineObserver.h
Comment 4 Anthony Vital 2009-08-21 18:15:28 UTC
-OK my bad, I wanted to post this text first :p
I know this bug is marked as duplicate, but I'm not really sure that both are related.
Anyways, I investigated the code a little bit, and I think I figured what's wrong:
The EngineObservers are stored in a QSet, which is unsorted (and unpredictable). So from time to time, when iterating through the EngineObservers (when EngineObserver::engineNewTrackPlaying() is triggered for instance), if Playlist::PrettyListView (where autoscroll is done) is coming before Playlist::Actions, then the playlist is being centered before Amarok moves on to the next track (as Gary said).
The problem is that there is no way to ensure a certain order in a QSet, so maybe the solution would be to use something like QList instead?
I add a small patch replacing QSet by QList to illustrate.
Comment 5 Anthony Vital 2009-08-21 18:16:16 UTC
Created attachment 36335 [details]
patch EngineObserver.cpp

second part of the patch
Comment 6 Myriam Schweingruber 2009-08-21 19:04:54 UTC
Anthony, please report your patch to the other bug. If you read the description, those are indeed the same bug, (ignore the second part of the initial bug message there).
This bug here is closed and nobody will see the patch here...
Comment 7 Anthony Vital 2009-08-22 02:14:03 UTC
Yes I'm sorry, you're right, I misunderstood it.