playlist: call InformOfCurrentSongChange only after updating the virtual index

Calling InformOfCurrentSongChange before updating the virtual index results in
sending the CanGoNext and CanGoPrevious notifications with the wrong values.
This commit is contained in:
Victor Dodon 2016-03-10 21:20:53 +00:00
parent 5f14e887a7
commit 5b066991ab

View File

@ -633,10 +633,6 @@ void Playlist::set_current_row(int i, bool is_stopping) {
old_current_item_index.row(), ColumnCount - 1)); old_current_item_index.row(), ColumnCount - 1));
} }
if (current_item_index_.isValid() && !is_stopping) {
InformOfCurrentSongChange();
}
// Update the virtual index // Update the virtual index
if (i == -1) { if (i == -1) {
current_virtual_index_ = -1; current_virtual_index_ = -1;
@ -655,6 +651,10 @@ void Playlist::set_current_row(int i, bool is_stopping) {
current_virtual_index_ = i; current_virtual_index_ = i;
} }
if (current_item_index_.isValid() && !is_stopping) {
InformOfCurrentSongChange();
}
// The structure of a dynamic playlist is as follows: // The structure of a dynamic playlist is as follows:
// history - active song - future // history - active song - future
// We have to ensure that this invariant is maintained. // We have to ensure that this invariant is maintained.