[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Daniel Caleb Jones <danielcjones () gmail ! com>
Date:       2008-07-07 7:11:25
Message-ID: 1215414685.042487.9794.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 828991 by djones:

Fix crash when dynamic mode is turned on with an empty collection.


 M  +9 -12     dynamic/BiasSolver.cpp  
 M  +4 -0      dynamic/DynamicPlaylist.cpp  
 M  +1 -1      playlist/PlaylistModel.cpp  


--- trunk/extragear/multimedia/amarok/src/dynamic/BiasSolver.cpp #828990:828991
@@ -61,17 +61,10 @@
     while( i-- && m_E >= epsilon  )  
     {
         iterate();
-
-        if( i % 100 == 0 )
-        {
-            debug() 
-                << "BiasSolver: (i, E, T) = (" 
-                << ITERATION_LIMIT - i << ", "
-                << m_E << ", " 
-                << m_T << ")";
-        }
     }
 
+    debug() << "BiasSolver: System solved in " << (ITERATION_LIMIT - i) << " \
iterations."; +
     setFinished( true );
 }
 
@@ -166,6 +159,11 @@
     double totalWeight = 0.0;
     double domainSize = calcDomainSize();
 
+    // Ahhh...empty collection!
+    if( domainSize == 0.0 ) 
+        return;
+
+
     foreach( Dynamic::Bias* b, m_biases )
     {
         Dynamic::GlobalBias* gb = dynamic_cast<Dynamic::GlobalBias*>( b );
@@ -215,9 +213,8 @@
         }
         else
         {
-            //TODO: the following lines cause runtime errors as in \
                http://pastebin.com/m561a20b9, please fix
-            //int choice = KRandom::random() % propertySets[active].size();
-            //m_playlist.append( propertySets[active][choice] );
+            int choice = KRandom::random() % propertySets[active].size();
+            m_playlist.append( propertySets[active][choice] );
         }
     }
 }
--- trunk/extragear/multimedia/amarok/src/dynamic/DynamicPlaylist.cpp #828990:828991
@@ -46,7 +46,11 @@
 {
     Meta::TrackList tracks;
     while( count-- )
+    {
         tracks.append( getTrack() );
+        if( tracks.back() == Meta::TrackPtr() )
+            break;
+    }
 
     tracks.removeAll( Meta::TrackPtr() );
 
--- trunk/extragear/multimedia/amarok/src/playlist/PlaylistModel.cpp #828990:828991
@@ -539,7 +539,7 @@
         if( !wasNull )
         {
             ((DynamicTrackNavigator*)m_advancer)->appendUpcoming();
-            if( activeRow() < 0 ) play( 0 );
+            if( activeRow() < 0 && rowCount() > 0 ) play( 0 );
 
         }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic