[PR #139] [MERGED] fix: Update current progress at new track load #628

Closed
opened 2026-02-28 14:50:16 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Rigellute/spotify-tui/pull/139
Author: @sputnick1124
Created: 11/6/2019
Status: Merged
Merged: 11/6/2019
Merged by: @Rigellute

Base: masterHead: prevent-overflow-panic


📝 Commits (1)

  • e9cd8ab fix: Update current progress at new track load

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 src/app.rs (+1 -0)

📄 Description

There was a race condition between selecting a new track and the track
progress updating; this caused the app to sometimes panic when
selecting a track which has a total duration less than the current
progress as it tries to report a negative remaining time in the playbar
(but it tries this with unsigned values).

/git/spot.. master λ › cargo run
   Compiling spotify-tui v0.8.0 (/home/user/git/spotify-tui)
    Finished dev [unoptimized + debuginfo] target(s) in 6.75s
     Running `target/debug/spt`
thread '<unnamed>' panicked at 'attempt to subtract with overflow', src/ui/util.rs:52:39
stack backtrace:
...
   6: core::panicking::panic
             at src/libcore/panicking.rs:49
   7: spt::ui::util::display_track_progress
             at src/ui/util.rs:52
   8: spt::ui::draw_playbar
             at src/ui/mod.rs:685
   9: spt::ui::draw_main_layout
             at src/ui/mod.rs:161
  10: spt::main::{{closure}}
             at src/main.rs:192
...

This, I think, was ultimately the root cause of https://github.com/Rigellute/spotify-tui/issues/125 and the solution we've been looking for with https://github.com/Rigellute/spotify-tui/pull/132 and https://github.com/Rigellute/spotify-tui/pull/126.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Rigellute/spotify-tui/pull/139 **Author:** [@sputnick1124](https://github.com/sputnick1124) **Created:** 11/6/2019 **Status:** ✅ Merged **Merged:** 11/6/2019 **Merged by:** [@Rigellute](https://github.com/Rigellute) **Base:** `master` ← **Head:** `prevent-overflow-panic` --- ### 📝 Commits (1) - [`e9cd8ab`](https://github.com/Rigellute/spotify-tui/commit/e9cd8ab7c5ba88a0f70f8b90b84cd1f512d8dc26) fix: Update current progress at new track load ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/app.rs` (+1 -0) </details> ### 📄 Description There was a race condition between selecting a new track and the track progress updating; this caused the app to sometimes panic when selecting a track which has a total duration less than the current progress as it tries to report a negative remaining time in the playbar (but it tries this with unsigned values). ```bash /git/spot.. master λ › cargo run Compiling spotify-tui v0.8.0 (/home/user/git/spotify-tui) Finished dev [unoptimized + debuginfo] target(s) in 6.75s Running `target/debug/spt` thread '<unnamed>' panicked at 'attempt to subtract with overflow', src/ui/util.rs:52:39 stack backtrace: ... 6: core::panicking::panic at src/libcore/panicking.rs:49 7: spt::ui::util::display_track_progress at src/ui/util.rs:52 8: spt::ui::draw_playbar at src/ui/mod.rs:685 9: spt::ui::draw_main_layout at src/ui/mod.rs:161 10: spt::main::{{closure}} at src/main.rs:192 ... ``` This, I think, was ultimately the root cause of https://github.com/Rigellute/spotify-tui/issues/125 and the solution we've been looking for with https://github.com/Rigellute/spotify-tui/pull/132 and https://github.com/Rigellute/spotify-tui/pull/126. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:50:16 +03:00
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/spotify-tui#628
No description provided.