[GH-ISSUE #420] Queue.fill() crash when switching playlists #270

Closed
opened 2026-02-28 14:31:47 +03:00 by kerem · 1 comment
Owner

Originally created by @wjp on GitHub (May 18, 2023).
Original GitHub issue: https://github.com/jpochyla/psst/issues/420

Describe the bug
When switching from a short playlist to a long playlist by starting a track at the end of the long playlist, Queue.fill/compute_positions crashes:

thread '<unnamed>' panicked at 'index out of bounds: the len is 24 but the index is 29', psst-core/src/player/queue.rs:57:13

To Reproduce
Start playing a relatively short playlist, then start the last track of a longer playlist.

Expected behavior
The new track starts playing.

Screenshots
N/A

Environment

  • OS: Linux
  • Version: current git master; f94af14aa9

Additional context
I think adding a line self.positions.clear() at the start of Queue.fill() (psst-core/src/player/queue.rs) should fix the issue. The problem seems to be that it sets self.position while compute_positions() is still assuming self.position points into the now-outdated self.positions vector.

Originally created by @wjp on GitHub (May 18, 2023). Original GitHub issue: https://github.com/jpochyla/psst/issues/420 **Describe the bug** When switching from a short playlist to a long playlist by starting a track at the end of the long playlist, Queue.fill/compute_positions crashes: ``` thread '<unnamed>' panicked at 'index out of bounds: the len is 24 but the index is 29', psst-core/src/player/queue.rs:57:13 ``` **To Reproduce** Start playing a relatively short playlist, then start the last track of a longer playlist. **Expected behavior** The new track starts playing. **Screenshots** N/A **Environment** - OS: Linux - Version: current git master; f94af14aa9fdd3d59cd92849fa7f076103b37a70 **Additional context** I think adding a line `self.positions.clear()` at the start of Queue.fill() (psst-core/src/player/queue.rs) should fix the issue. The problem seems to be that it sets self.position while compute_positions() is still assuming self.position points into the now-outdated self.positions vector.
kerem 2026-02-28 14:31:47 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@cameronraw commented on GitHub (May 19, 2023):

I managed to recreate the bug following your instructions, and since making your suggested change haven't been able to reproduce it at all. If I can get assigned to the issue, I have a branch with the change.

This is my first contribution to OS so I'm presuming (as I've forked the repo already) I can simply push the branch to my own fork and then create a pull request, assuming I've been assigned the issue?

Many thanks

EDIT: having seen it doesn't appear to be necessary to be assigned to an issue, I've raised a PR anyway. I hope that's fine.

EDIT: ... just saw the contribution guidelines and replaced the previous PR with a new one. Sorry for the confusion.

<!-- gh-comment-id:1554477993 --> @cameronraw commented on GitHub (May 19, 2023): I managed to recreate the bug following your instructions, and since making your suggested change haven't been able to reproduce it at all. If I can get assigned to the issue, I have a branch with the change. This is my first contribution to OS so I'm presuming (as I've forked the repo already) I can simply push the branch to my own fork and then create a pull request, assuming I've been assigned the issue? Many thanks EDIT: having seen it doesn't appear to be necessary to be assigned to an issue, I've raised a PR anyway. I hope that's fine. EDIT: ... just saw the contribution guidelines and replaced the previous PR with a new one. Sorry for the confusion.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/psst#270
No description provided.