Bug 111579

Summary: Amarok multiplicating added entries in custom playlists.
Product: [Applications] amarok Reporter: Kristjan Ugrin <kristjan.ugrin>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: trapni, xepo
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: This patch fixes the problem. But I have no clue, why the line was put in, (or what the comment should say)
prevents load() from attempting to load twice at once.

Description Kristjan Ugrin 2005-08-26 20:13:13 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    SuSE RPMs

Start Amarok. Switch to playlists. Don't expand your custom playlist!!! Just drag some songs from playlist to your custom playlist. Expand it. Some entries will be displayed more than once.
Comment 1 Mark Kretschmann 2005-08-26 20:39:21 UTC
You forgot to specify the program version :(
Comment 2 Kristjan Ugrin 2005-08-27 18:32:37 UTC
Sorry, latest SVN (updated daily).
Comment 3 Kristjan Ugrin 2005-09-14 23:01:20 UTC
I can still confirm this behaviour (todays svn version). It doesn't happen everytime. It should be more investigated, try restarting amarok and repeat above steps.
Comment 4 Alexandre Oliveira 2005-09-15 01:35:47 UTC
You're the only one reporting this, so you've got to explain it better. What do you mean by "custom playlist"? Any playlist created by the user?
Comment 5 Kristjan Ugrin 2005-09-16 21:00:38 UTC
Yes, I created a playlist under Playlists branch (created by user).
Comment 6 Kristjan Ugrin 2005-09-19 22:38:20 UTC
I can reproduce it 100% in latest svn version, follow the updated steps:
Start Amarok. Switch to playlists view. Make sure you have already loaded some tracks in main playlist. Create a custom playlist by dragging a track from main playlist onto playlists folder. Enter a name for it, eg.: MyMusic. Save it (right click->Save) and restart amarok.
Don't expand any of your custom playlist (playlist under playlists tree)!!! Drag a track from main playlist to a custom playlist (MyMusic in this case). Save it (right click->Save). Expand it. Last entry will show up twice at bottom.
Comment 7 Kristjan Ugrin 2005-09-20 22:02:02 UTC
Tried on 2 different computers, still I can reproduce this.

Interresting: I've switched to detailed view under playlists section, so you can see number of items in each playlist. I started amarok and under playlist named Cool, they were 23 items. I counted it manually, everything was ok. Then I restarted amarok (you should restart it otherwise it is not possible to reproduce this 100%), item nuber was still correct, the I dragged a track to playlist Cool, item number increased to 24 (which is correct), but when I clicked expand (the + button), item nuber increased again showing 25 items and last entry was doubled! This behaviour is going on for some time and it is annoying! Please someone fix it. If you need more details, or if you don't understand what I'm writing, just ask (I know, my english is crappy).
Comment 8 Alexandre Oliveira 2005-09-20 22:14:55 UTC
Thanks for the description! Gotta look into that.
Comment 9 Alexandre Oliveira 2005-09-21 01:22:29 UTC
SVN commit 462399 by aoliveira:

Adding entries to a playlist and saving it could duplicate some tracks, if the playlist hadn't been expanded before. 
BUG: 111579


 M  +10 -0     ChangeLog  
 M  +1 -0      src/playlistbrowseritem.cpp  


--- trunk/extragear/multimedia/amarok/ChangeLog #462398:462399
@@ -3,6 +3,16 @@
 (C) 2002-2005 the amaroK authors.
 
 
+VERSION 1.3.3:
+  FEATURES:
+
+  CHANGES:
+
+  BUGFIXES:
+    * Adding entries to a playlist and saving it could duplicate some tracks,
+      if the playlist hadn't been expanded before. (BR 111579)
+
+
 VERSION 1.3.2:
   FEATURES:
     * Tabs will open automatically when dragging files between tabs.
--- trunk/extragear/multimedia/amarok/src/playlistbrowseritem.cpp #462398:462399
@@ -487,6 +487,7 @@
         else {
             delete m_savePix;
             m_savePix = 0;
+            tmp_droppedTracks.clear();
         }
 
         m_modified = chg;
Comment 10 Kristjan Ugrin 2005-09-21 01:34:21 UTC
Thanks!
Comment 11 Kristjan Ugrin 2005-10-13 21:53:37 UTC
This bug is present in latest svn again + playlist doesn't have save option after adding some tracks anymore (or it is a feature? I can't see it in changelog.)
Comment 12 Kristjan Ugrin 2005-10-16 22:39:46 UTC
Steps to reproduce this are described in comments 6,7.
Comment 13 Alexandre Oliveira 2005-10-16 23:01:33 UTC
Playlists are saved automatically now.
Comment 14 Kristjan Ugrin 2005-10-21 22:53:14 UTC
Noone can confirm this? I can, still present in latest svn. I hope you don't forget to fix it before new stable release.
Comment 15 Kristjan Ugrin 2005-11-05 16:41:15 UTC
Amarok 1.4 svn has this problem too.
Comment 16 Kristjan Ugrin 2005-11-12 15:14:10 UTC
Aditional info on this bug: It occurs when creating new playlist by dragging tracks from ’main‘ playlist to playlist folder (red one). 
Instructions: Drag an entry (track) to red folder named playlists. Amarok will pop-up a window, asking you a name for new playlist, enter wathever you want. After you click ok, a custom playlist will be created with duplicated entries.

Confirmed in latest svn (1.4).
Comment 17 Roland 2005-11-30 22:49:23 UTC
Created attachment 13698 [details]
This patch fixes the problem.
But I have no clue, why the line was put in, (or what the comment should say)
Comment 18 Isaiah Damron 2005-12-01 21:20:15 UTC
Created attachment 13721 [details]
prevents load() from attempting to load twice at once.

Roland, when I tried your patch on the latest SVN, it caused it to show the
playlist as empty, instead of two elements.
--

The problem started occurring again because load() was being called twice, and
even though m_loading was being updated (true while currently loading, false
when not), it wasn't being used to prevent multiple calls to load().  This
patch simply adds an if (m_loading) return; at the beginning of load().

Basically, here's the sequence of events:  load() is called, playlist is
cleared, actual loading is queued.  Before actual loading occurs, load() is
called again, playlist is cleared again, actual loading is queued again.  Then
the actual loading occurs twice.

Note: This is an entirely different issue than before.	Even after this fix,
uncommenting the code in customEvent() that utilizes tmp_droppedTracks still
causes duplicates.  Only with both changes will it work correctly.
Comment 19 Isaiah Damron 2005-12-03 21:43:05 UTC
I've committed this to SVN, forgot to CCBUG it.  
Comment 20 Alexandre Oliveira 2005-12-03 21:57:20 UTC
Then close it ;-)
Comment 21 Isaiah Damron 2005-12-05 21:16:21 UTC
*** Bug 114622 has been marked as a duplicate of this bug. ***