<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>193459</bug_id>
          
          <creation_ts>2009-05-21 08:35:42 +0000</creation_ts>
          <short_desc>[Patch] Automatically scroll playlist broken in some cases</short_desc>
          <delta_ts>2009-12-09 11:34:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>amarok</product>
          <component>Playlist</component>
          <version>2.3-GIT</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jesús Vidal">jesusvpct</reporter>
          <assigned_to name="Amarok Bugs">amarok-bugs-null</assigned_to>
          <cc>alex</cc>
    
    <cc>anthony.vital</cc>
    
    <cc>jeanpaul145</cc>
    
    <cc>nhn</cc>
    
    <cc>ruiz</cc>
    
    <cc>teo</cc>
    
    <cc>webmaster</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>20</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>761289</commentid>
    <comment_count>0</comment_count>
    <who name="Jesús Vidal">jesusvpct</who>
    <bug_when>2009-05-21 08:35:42 +0000</bug_when>
    <thetext>Version:           2.0.90 (using KDE 4.2.3)
OS:                Linux
Installed from:    Ubuntu Packages

I have found two little bugs:

1º When you press the Next track button, the playlist scroll to next track and you see it, but if you use key shortcut (in my case Winkey + B), the list scroll to the previous track and not to the current.

2º If amarok is iconified, and you restore again, the playlist is on top

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>761995</commentid>
    <comment_count>1</comment_count>
    <who name="Seb Ruiz">ruiz</who>
    <bug_when>2009-05-22 14:36:40 +0000</bug_when>
    <thetext>In the future please create one report per bug. I&apos;ve left this open because the first bug is valid, but the second one is now (i don&apos;t understand it and it is most likely fixed).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>791882</commentid>
    <comment_count>2</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2009-07-14 09:47:32 +0000</bug_when>
    <thetext>*** Bug 195399 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>792007</commentid>
    <comment_count>3</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2009-07-14 13:52:56 +0000</bug_when>
    <thetext>The second means if Amarok doesn&apos;t have focus and you come back, the playlist has scrolled back to the top. A better description is available in bug 199889, which is set as a duplicate to bug 193459.
There seems to be a general problem with the playlist scrolling though, maybe putting these bugs together?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>792997</commentid>
    <comment_count>4</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2009-07-15 21:32:10 +0000</bug_when>
    <thetext>*** Bug 199889 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816623</commentid>
    <comment_count>5</comment_count>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-08-22 02:16:32 +0000</bug_when>
    <thetext>I investigated the code a little bit, and I think I figured what&apos;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.
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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816624</commentid>
    <comment_count>6</comment_count>
      <attachid>36345</attachid>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-08-22 02:17:51 +0000</bug_when>
    <thetext>Created attachment 36345
EngineObserver.h patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816625</commentid>
    <comment_count>7</comment_count>
      <attachid>36346</attachid>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-08-22 02:18:16 +0000</bug_when>
    <thetext>Created attachment 36346
EngineObserver.cpp patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>817280</commentid>
    <comment_count>8</comment_count>
    <who name="Mikko C.">mikko.cal</who>
    <bug_when>2009-08-23 13:27:15 +0000</bug_when>
    <thetext>*** Bug 201649 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828017</commentid>
    <comment_count>9</comment_count>
    <who name="Teo Mrnjavac">teo</who>
    <bug_when>2009-09-09 20:32:09 +0000</bug_when>
    <thetext>Oops
Sorry for taking so long, there seems to have been some mixup with bug assignement :-/
We&apos;ll check your patch ASAP</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828046</commentid>
    <comment_count>10</comment_count>
    <who name="Teo Mrnjavac">teo</who>
    <bug_when>2009-09-09 21:20:05 +0000</bug_when>
    <thetext>I can&apos;t reproduce this, neither 1) nor 2).
Can somebody else try please?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828053</commentid>
    <comment_count>11</comment_count>
    <who name="Nikolaj Hald Nielsen">nhn</who>
    <bug_when>2009-09-09 21:37:00 +0000</bug_when>
    <thetext>I cannot reproduce these issues with latest git master either. Closing it until someone can reproduce with current git.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828110</commentid>
    <comment_count>12</comment_count>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-09-09 23:24:48 +0000</bug_when>
    <thetext>Well I can. To be clear, I&apos;m talking about the first bug. If you look at the different duplicated reports, you can find more informations about it. 
And again, it doesn&apos;t happen all the time. If the bug happens, you can notice it on the first &quot;next track&quot; triggered in Amarok. If not, the bug won&apos;t bother you until you close Amarok. But chances are that the bug appears when you launch Amarok again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828130</commentid>
    <comment_count>13</comment_count>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-09-10 00:33:44 +0000</bug_when>
    <thetext>better: screencast showing the bug
http://dl.free.fr/rIC00XSil</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828149</commentid>
    <comment_count>14</comment_count>
    <who name="Seb Ruiz">ruiz</who>
    <bug_when>2009-09-10 02:51:35 +0000</bug_when>
    <thetext>I&apos;m frequently reproducing the issue, but cannot gather a reliable case on how to reproduce.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>834631</commentid>
    <comment_count>15</comment_count>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-09-23 13:45:10 +0000</bug_when>
    <thetext>Any chance to have this reviewed for the 2.2 final release?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>834639</commentid>
    <comment_count>16</comment_count>
    <who name="Teo Mrnjavac">teo</who>
    <bug_when>2009-09-23 14:01:44 +0000</bug_when>
    <thetext>Sure, we&apos;ll take a look right now. Good thing you poked :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>834844</commentid>
    <comment_count>17</comment_count>
    <who name="Teo Mrnjavac">teo</who>
    <bug_when>2009-09-23 22:03:22 +0000</bug_when>
    <thetext>I&apos;ve tried reproducing this, but had no luck :-/
The patch seems sane, however I&apos;d like someone who can reproduce test it before pushing.
Seb, since you managed to reproduce it, could you please take a look?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>841324</commentid>
    <comment_count>18</comment_count>
    <who name="">alex</who>
    <bug_when>2009-10-07 10:38:58 +0000</bug_when>
    <thetext>I&apos;ve had this bug since the release of 2.1.0, it happens every time. For example, I&apos;ve just started Amarok 2.2.0 up this morning, and it started to play a track (the last one that I played before I closed Amarok) however I wanted to skip it so I pressed the big &apos;Next&apos; button.

This did change the track which is playing, however it did not scroll the playlist to the location of the new track. Now when ever I press next again, it does move but is obviously &apos;off by one&apos; and shows the previous one.

I have all 1,321 songs in 1 playlist that it goes through, if that is of any relevance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>841373</commentid>
    <comment_count>19</comment_count>
    <who name="Mark Kretschmann">kretschmann</who>
    <bug_when>2009-10-07 12:33:34 +0000</bug_when>
    <thetext>What Anthony said makes sense. I will look at the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>841383</commentid>
    <comment_count>20</comment_count>
    <who name="Mark Kretschmann">kretschmann</who>
    <bug_when>2009-10-07 12:54:49 +0000</bug_when>
    <thetext>I&apos;ve committed a fix to git master (will surface in 2.2.1). Thanks again Anthony!


commit a9a46b6ceab835c646b89d744bfcc5a7176ef5c1
Author: Mark Kretschmann &lt;kretschmann@kde.org&gt;
Date:   Wed Oct 7 12:50:25 2009 +0200

    Fix: Automatic playlist scrolling was broken in some cases.

    The actual bug was very very nasty. EngineObserver used QSet for storing
    observer pointers. This is what Qt docs say:
    &quot;QSet is unordered, so an iterator&apos;s sequence cannot be assumed to be predictable.&quot;
    Now we&apos;re using QList, whose iteration order is predictable.

    Thanks to Anthony Vital for pointing this out.

    BUG: 193459</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>842601</commentid>
    <comment_count>21</comment_count>
    <who name="Mark Kretschmann">kretschmann</who>
    <bug_when>2009-10-09 19:54:37 +0000</bug_when>
    <thetext>The patch was unfortunately not correct. The real problem is in the playlist itself, it shouldn&apos;t be coupled to the ordering of Observers. Reverted.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>842615</commentid>
    <comment_count>22</comment_count>
    <who name="Mark Kretschmann">kretschmann</who>
    <bug_when>2009-10-09 20:35:08 +0000</bug_when>
    <thetext>I&apos;ve committed a better fix, please test:


commit c17fa232fe8c3bbf1fd1b80d74c573dd75d1b9a1
Author: Mark Kretschmann &lt;kretschmann@kde.org&gt;
Date:   Fri Oct 9 20:23:28 2009 +0200

    Proper fix for Automatic Scrolling in playlist. Please test.

    Moved the scrolling from Playlist::View to PlaylistActions.
    Thanks to Seb Ruiz for coming up with the idea.

    BUG: 193459</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>842713</commentid>
    <comment_count>23</comment_count>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-10-10 01:50:57 +0000</bug_when>
    <thetext>This works fine here.
(Note: It seems that the previous patch hasn&apos;t been reverted in git master...)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>842752</commentid>
    <comment_count>24</comment_count>
    <who name="Mark Kretschmann">kretschmann</who>
    <bug_when>2009-10-10 09:16:03 +0000</bug_when>
    <thetext>@Anthony: It has been reverted, see here:

http://gitorious.org/amarok/amarok/blobs/master/src/EngineObserver.h


PS: Thanks for testing :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>844094</commentid>
    <comment_count>25</comment_count>
    <who name="Anthony Vital">anthony.vital</who>
    <bug_when>2009-10-12 18:44:39 +0000</bug_when>
    <thetext>(In reply to comment #24)
&gt; @Anthony: It has been reverted, see here:
&gt; 
&gt; http://gitorious.org/amarok/amarok/blobs/master/src/EngineObserver.h
hmm... EngineObserver* are still stored in a QList here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>844099</commentid>
    <comment_count>26</comment_count>
    <who name="Mark Kretschmann">kretschmann</who>
    <bug_when>2009-10-12 18:51:03 +0000</bug_when>
    <thetext>Uhm. You&apos;re right. Something went wrong with the revert... I&apos;ll fix, thanks.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>36345</attachid>
            <date>2009-08-22 02:17:51 +0000</date>
            <delta_ts>2009-08-22 02:17:51 +0000</delta_ts>
            <desc>EngineObserver.h patch</desc>
            <filename>patch_EngineObserver_h.diff</filename>
            <type>text/plain</type>
            <size>558</size>
            <attacher name="Anthony Vital">anthony.vital</attacher>
            
              <data encoding="base64">LS0tIEVuZ2luZU9ic2VydmVyLmh+CTIwMDktMDgtMjEgMTY6NDI6MzIuNTA1MTM5Mzk2ICswMjAw
CisrKyBFbmdpbmVPYnNlcnZlci5oCTIwMDktMDgtMjEgMTY6NDI6MzIuNTYxMTQ1ODIwICswMjAw
CkBAIC0yMyw3ICsyMyw2IEBACiAjaW5jbHVkZSA8UGhvbm9uL0dsb2JhbD4KICNpbmNsdWRlIDxR
SGFzaD4KICNpbmNsdWRlIDxRUG9pbnRlcj4KLSNpbmNsdWRlIDxRU2V0PgogCiBjbGFzcyBFbmdp
bmVTdWJqZWN0OwogY2xhc3MgUVN0cmluZzsKQEAgLTEyOSw3ICsxMjgsNyBAQCBwcml2YXRlOgog
ICAgIGJvb2wgaXNNZXRhRGF0YVNwYW0oIFFIYXNoPHFpbnQ2NCwgUVN0cmluZz4gbmV3TWV0YURh
dGEgKTsKIAogICAgIFFMaXN0PFFIYXNoPHFpbnQ2NCwgUVN0cmluZz4gPiBtX21ldGFEYXRhSGlz
dG9yeTsKLSAgICBRU2V0PEVuZ2luZU9ic2VydmVyKj4gT2JzZXJ2ZXJzOworICAgIFFMaXN0PEVu
Z2luZU9ic2VydmVyKj4gT2JzZXJ2ZXJzOwogICAgIFBob25vbjo6U3RhdGUgbV9yZWFsU3RhdGU7
IC8vIFRvIHdvcmsgYXJvdW5kIHRoZSBidWZmZXJpbmcgaXNzdWUKIH07CiAK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>36346</attachid>
            <date>2009-08-22 02:18:16 +0000</date>
            <delta_ts>2009-08-22 02:18:16 +0000</delta_ts>
            <desc>EngineObserver.cpp patch</desc>
            <filename>patch_EngineObserver_cpp.diff</filename>
            <type>text/plain</type>
            <size>484</size>
            <attacher name="Anthony Vital">anthony.vital</attacher>
            
              <data encoding="base64">LS0tIEVuZ2luZU9ic2VydmVyLmNwcH4JMjAwOS0wOC0yMSAxNjo0Mjo1NS4wNjUxNDA4MDIgKzAy
MDAKKysrIEVuZ2luZU9ic2VydmVyLmNwcAkyMDA5LTA4LTIxIDE2OjQyOjU1LjEyMTE0MzczNCAr
MDIwMApAQCAtMjExLDEzICsyMTEsMTMgQEAgdm9pZCBFbmdpbmVTdWJqZWN0OjphdHRhY2goIEVu
Z2luZU9ic2VydgogewogICAgIGlmKCAhb2JzZXJ2ZXIgKQogICAgICAgICByZXR1cm47Ci0gICAg
T2JzZXJ2ZXJzLmluc2VydCggb2JzZXJ2ZXIgKTsKKyAgICBPYnNlcnZlcnMuYXBwZW5kKCBvYnNl
cnZlciApOwogfQogCiAKIHZvaWQgRW5naW5lU3ViamVjdDo6ZGV0YWNoKCBFbmdpbmVPYnNlcnZl
ciAqb2JzZXJ2ZXIgKQogewotICAgIE9ic2VydmVycy5yZW1vdmUoIG9ic2VydmVyICk7CisgICAg
T2JzZXJ2ZXJzLnJlbW92ZUFsbCggb2JzZXJ2ZXIgKTsKIH0KIAogLyogVHJ5IHRvIGRldGVjdCBN
ZXRhRGF0YSBzcGFtIGluIFN0cmVhbXMuICovCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>