Merge lp:~vthompson/music-app/remix-fix-1379923 into lp:music-app/remix

Proposed by Victor Thompson
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 663
Merged at revision: 664
Proposed branch: lp:~vthompson/music-app/remix-fix-1379923
Merge into: lp:music-app/remix
Diff against target: 28 lines (+5/-3)
1 file modified
MusicNowPlaying.qml (+5/-3)
To merge this branch: bzr merge lp:~vthompson/music-app/remix-fix-1379923
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+238026@code.launchpad.net

Commit message

Remove deleted item before updating currentIndex

Description of the change

Remove deleted item before updating currentIndex. This prevents an off-by-one error that is causing the currentIndex to not match the item in the queue.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

LGTM, seems to resolve the issue and not regress, hopefully we won't find any more cases :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MusicNowPlaying.qml'
2--- MusicNowPlaying.qml 2014-10-10 17:56:32 +0000
3+++ MusicNowPlaying.qml 2014-10-10 20:07:46 +0000
4@@ -448,6 +448,8 @@
5
6 leftSideAction: Remove {
7 onTriggered: {
8+ var removedIndex = index
9+
10 if (queuelist.count === 1) {
11 player.stop()
12 musicToolbar.goBack()
13@@ -455,12 +457,12 @@
14 player.nextSong(player.isPlaying);
15 }
16
17- if (index < player.currentIndex) {
18+ queuelist.model.remove(index);
19+
20+ if (removedIndex < player.currentIndex) {
21 // update index as the old has been removed
22 player.currentIndex -= 1;
23 }
24-
25- queuelist.model.remove(index);
26 }
27 }
28 reorderable: true

Subscribers

People subscribed via source and target branches