Bug 145157

Summary: pressing play in a "Random Mix" crashes Amarok
Product: [Applications] amarok Reporter: salijos
Component: Playlists/Saved PlaylistsAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: crash CC: thomas.lindroth
Priority: NOR    
Version: 1.4.5   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description salijos 2007-05-07 21:13:01 UTC
Version:           1.4.5 (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages
Compiler:          gcc 4.1.1 
OS:                Linux

If a "Random Mix" smart playlist is active, and "played tracks to show" is set to 0, then pressing play or double-clicking on the first item in the playlist will cause Amarok to crash.  The only exception to this is the first time a random mix is played, double-clicking the first item in the playlist won't crash it the first time.  I tried setting "played tracks to show" to 1, and it works fine.
Comment 1 Mark Kretschmann 2007-05-07 21:24:17 UTC

*** This bug has been marked as a duplicate of 144121 ***
Comment 2 Jeff Mitchell 2007-05-07 23:15:05 UTC
I don't think this is the same bug.  I can duplicate this, but not bug 144121.
Comment 3 Jeff Mitchell 2007-05-07 23:15:24 UTC
Reopening.
Comment 4 Jeff Mitchell 2007-05-07 23:18:42 UTC
This only happens if it was also the currently playing track.  For instance, if you are playing the top track, and then sort the playlist by some value so that it is no longer the top track, and then try to play the top track, there's no crash.
Comment 5 Jeff Mitchell 2007-05-08 00:44:58 UTC
SVN commit 662353 by mitchell:

Fix...
BUG: 145157


 M  +9 -4      playlist.cpp  


--- branches/stable/extragear/multimedia/amarok/src/playlist.cpp #662352:662353
@@ -1604,14 +1604,17 @@
 
     if ( !checkFileStatus( item ) )
     {
-	Amarok::StatusBar::instance()->shortMessage( i18n("Local file does not exist.") );
-	return;
+        Amarok::StatusBar::instance()->shortMessage( i18n("Local file does not exist.") );
+        return;
     }
 
     if( dynamicMode() && !m_dynamicDirt && !Amarok::repeatTrack() )
     {
         if( m_currentTrack && item->isDynamicEnabled() )
-            this->moveItem( item, 0, m_currentTrack );
+        {
+            if( item != m_currentTrack )
+                this->moveItem( item, 0, m_currentTrack );
+        }
         else
         {
             MyIt it( this, MyIt::Visible );
@@ -1639,8 +1642,10 @@
 
         }
         if( m_currentTrack && m_currentTrack != item )
+        {
             m_currentTrack->setDynamicEnabled( false );
-        advanceDynamicTrack();
+            advanceDynamicTrack();
+        }
     }
 
     if( Amarok::entireAlbums() )
Comment 6 Jeff Mitchell 2007-05-08 00:45:44 UTC
*** Bug 144121 has been marked as a duplicate of this bug. ***
Comment 7 salijos 2007-05-08 08:10:07 UTC
The patch given works fine.  Thanks!