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

List:       kde-commits
Subject:    [amarok] /: Fix long-standing bug: APG returns empty playlist
From:       Soren Harward <stharward () gmail ! com>
Date:       2015-06-01 2:57:24
Message-ID: E1YzFum-0005dW-JN () scm ! kde ! org
[Download RAW message or body]

Git commit 0b7492e709d9c8c37e8d9e74f549d0073b775b19 by Soren Harward.
Committed on 01/06/2015 at 02:53.
Pushed by stharward into branch 'master'.

Fix long-standing bug: APG returns empty playlist

Well, that was dumb.  Added a sanity check where if the suggested
playlist size is 0 (which means "I don't really care what the playlist
size is"), then just go with whatever the non-zero size from the
previous iteration was.

BUG: 313762
BUG: 315206
BUG: 323945

FIXED-IN: 2.9

M  +2    -0    ChangeLog
M  +2    -1    src/playlistgenerator/ConstraintSolver.cpp

http://commits.kde.org/amarok/0b7492e709d9c8c37e8d9e74f549d0073b775b19

diff --git a/ChangeLog b/ChangeLog
index 58c745e..2cce0f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,8 @@ VERSION 2.8.90
      compilers currently supported by KDE.
 
   BUGFIXES:
+   * Fixed longstanding APG zero-length playlist bug (BR 313762, BR 315206,
+     BR 323945)
    * Fix a crash when searching the Icecast directory. (BR 334479)
    * Correct wrong lowercase for FLAC and MP3. Patch provided by Duilio Felix (BR 339495)
    * Collection Browser no longer excessively expands the tree. (BR 300557)
diff --git a/src/playlistgenerator/ConstraintSolver.cpp b/src/playlistgenerator/ConstraintSolver.cpp
index 56838dc..ba58a9c 100644
--- a/src/playlistgenerator/ConstraintSolver.cpp
+++ b/src/playlistgenerator/ConstraintSolver.cpp
@@ -159,7 +159,8 @@ APG::ConstraintSolver::run()
     quint32 generation = 0;
     Meta::TrackList* best = NULL;
     while ( !m_abortRequested && ( generation < m_maxGenerations ) ) {
-        m_suggestedPlaylistSize = m_constraintTreeRoot->suggestPlaylistSize();
+        quint32 s = m_constraintTreeRoot->suggestPlaylistSize();
+        m_suggestedPlaylistSize = (s > 0) ? s : m_suggestedPlaylistSize;
         fill_population( population );
         best = find_best( population );
         if ( population.value( best ) < m_satisfactionThreshold ) {
[prev in list] [next in list] [prev in thread] [next in thread] 

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