From kde-commits Mon Sep 01 19:05:40 2008 From: Alex Merry Date: Mon, 01 Sep 2008 19:05:40 +0000 To: kde-commits Subject: extragear/multimedia/amarok/src/playlist Message-Id: <1220295940.416352.17817.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=122029594831179 SVN commit 855940 by alexmerry: We're still getting the "tracks occasionally repeating" bug, but much, much less frequently. Which makes it harder to debug, of course. So, insert some useful debugging statements. As a bonus: don't let people calling Playlist::Model::play(-1) cause havoc, not to mention crash Amarok, by trying to access index -1 of a QList. M +28 -1 PlaylistModel.cpp --- trunk/extragear/multimedia/amarok/src/playlist/PlaylistModel.cpp #855939:855940 @@ -186,9 +186,14 @@ if( !m_stopPlaying && rowExists( row ) ) { + debug() << "Will play row" << row; m_nextRowCandidate = row; The::engineController()->setNextTrack( m_items.at(row)->track() ); } + else + { + debug() << "Invalid row" << row; + } m_waitingForNextTrack = false; } @@ -200,9 +205,14 @@ if( !m_stopPlaying && rowExists( row ) ) { + debug() << "Will play row" << row; m_nextRowCandidate = row; play( row ); } + else + { + debug() << "Invalid row" << row; + } m_waitingForNextTrack = false; } @@ -214,9 +224,14 @@ if( !m_stopPlaying && rowExists( row ) ) { + debug() << "Will play row" << row; m_nextRowCandidate = row; play( row ); } + else + { + debug() << "Invalid row" << row; + } m_waitingForNextTrack = false; } @@ -465,13 +480,20 @@ void Playlist::Model::play( int row ) { + DEBUG_BLOCK + m_stopPlaying = false; - if( m_items.size() > row ) + if( rowExists( row ) && m_items.size() > row ) { + debug() << "Will play row" << row; m_nextRowCandidate = row; The::engineController()->play( m_items[ row ]->track() ); } + else + { + debug() << "Invalid row" << row; + } } void @@ -945,6 +967,7 @@ if( rowExists( m_nextRowCandidate ) && track == m_items.at( m_nextRowCandidate )->track() ) { + debug() << "Moving to the next row in the sequence"; setActiveRow( m_nextRowCandidate ); emit activeRowChanged( oldActiveRow, activeRow() ); @@ -966,6 +989,10 @@ emit activeRowChanged( oldActiveRow, activeRow() ); } } + else + { + debug() << "engineNewTrackPlaying: Track not set!"; + } m_nextRowCandidate = -1; }