VideoTools/internal
Stu Leak da49a1dd7b fix(queue): Prevent massive goroutine leak from StripedProgress animations
Critical Fix:
- Goroutine dump showed hundreds of leaked animation goroutines
- Each queue refresh created NEW progress bars without stopping old ones
- Animation goroutines continued running forever, consuming resources

Root Cause:
- BuildQueueView() creates new StripedProgress widgets on every refresh
- StartAnimation() spawned goroutines for running jobs
- Old widgets were discarded but goroutines never stopped
- Fyne's Destroy() method not reliably called when rebuilding view

Solution:
- Track all active StripedProgress widgets in appState.queueActiveProgress
- Stop ALL animations before rebuilding queue view
- Stop ALL animations when leaving queue view (stopQueueAutoRefresh)
- BuildQueueView now returns list of active progress bars
- Prevents hundreds of leaked goroutines from accumulating

Implementation:
- Added queueActiveProgress []*ui.StripedProgress to appState
- Modified BuildQueueView signature to return progress list
- Stop old animations in refreshQueueView() before calling BuildQueueView
- Stop all animations in stopQueueAutoRefresh() when navigating away
- Track running job progress bars and append to activeProgress slice

Files Changed:
- main.go: appState field, refreshQueueView(), stopQueueAutoRefresh()
- internal/ui/queueview.go: BuildQueueView(), buildJobItem()

Impact:
- Eliminates goroutine leak that caused resource exhaustion
- Clean shutdown of animation goroutines on refresh and navigation
- Should dramatically reduce memory usage and CPU overhead

Reported-by: User (goroutine dump showing 900+ leaked goroutines)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 19:24:17 -05:00
..
app Format cleanup and minor fixes 2025-12-23 21:56:47 -05:00
benchmark Fix benchmark progress bar percentage calculation 2025-12-13 14:04:20 -05:00
convert Format cleanup and minor fixes 2025-12-23 21:56:47 -05:00
interlace Format cleanup and minor fixes 2025-12-23 21:56:47 -05:00
logging Refactor to modular architecture with rainbow UI (v0.1.0-dev8) 2025-11-23 14:56:37 -05:00
metadata Add queue error copy, auto naming helper, and metadata templating 2025-12-07 12:03:21 -05:00
modules Group DVD modules and add responsive menu 2025-12-24 00:08:56 -05:00
player Implement VT_Player module with frame-accurate video playback 2025-12-21 16:31:44 -05:00
queue Add rip job type 2025-12-23 21:22:37 -05:00
sysinfo Format cleanup and minor fixes 2025-12-23 21:56:47 -05:00
thumbnail Import json/strconv for thumbnail ffprobe parsing 2025-12-17 19:09:43 -05:00
ui fix(queue): Prevent massive goroutine leak from StripedProgress animations 2025-12-28 19:24:17 -05:00
utils Add configurable temp directory with SSD hint 2025-12-20 19:55:13 -05:00