Compare commits

..

No commits in common. "b41e41e5ad5ace69177aca3bdede0c58c189665f" and "b3e448f2fe5859c43ebd34bb8b8e398dc86ab8ae" have entirely different histories.

3 changed files with 8 additions and 48 deletions

View File

@ -7,8 +7,6 @@ import (
"os/exec"
"path/filepath"
"time"
"git.leaktechnologies.dev/stu/VideoTools/internal/utils"
)
// Result stores the outcome of a single encoder benchmark test
@ -62,7 +60,6 @@ func (s *Suite) GenerateTestVideo(ctx context.Context, duration int) (string, er
}
cmd := exec.CommandContext(ctx, s.FFmpegPath, args...)
utils.ApplyNoWindow(cmd) // Hide command window on Windows during benchmark test video generation
if err := cmd.Run(); err != nil {
return "", fmt.Errorf("failed to generate test video: %w", err)
}
@ -134,7 +131,6 @@ func (s *Suite) TestEncoder(ctx context.Context, encoder, preset string) Result
// Measure encoding time
start := time.Now()
cmd := exec.CommandContext(ctx, s.FFmpegPath, args...)
utils.ApplyNoWindow(cmd) // Hide command window on Windows during benchmark encoding test
if err := cmd.Run(); err != nil {
result.Error = fmt.Sprintf("encoding failed: %v", err)

View File

@ -212,9 +212,7 @@ func BuildQueueView(
onViewLog func(string),
onCopyCommand func(string),
titleColor, bgColor, textColor color.Color,
) (fyne.CanvasObject, *container.Scroll, []*StripedProgress) {
// Track active progress animations to prevent goroutine leaks
var activeProgress []*StripedProgress
) (fyne.CanvasObject, *container.Scroll) {
// Header
title := canvas.NewText("JOB QUEUE", titleColor)
title.TextStyle = fyne.TextStyle{Monospace: true, Bold: true}
@ -266,7 +264,7 @@ func BuildQueueView(
}
for _, job := range jobs {
jobItems = append(jobItems, buildJobItem(job, queuePositions, onPause, onResume, onCancel, onRemove, onMoveUp, onMoveDown, onCopyError, onViewLog, onCopyCommand, bgColor, textColor, &activeProgress))
jobItems = append(jobItems, buildJobItem(job, queuePositions, onPause, onResume, onCancel, onRemove, onMoveUp, onMoveDown, onCopyError, onViewLog, onCopyCommand, bgColor, textColor))
}
}
@ -282,7 +280,7 @@ func BuildQueueView(
scrollable,
)
return container.NewPadded(body), scrollable, activeProgress
return container.NewPadded(body), scrollable
}
// buildJobItem creates a single job item in the queue list
@ -299,7 +297,6 @@ func buildJobItem(
onViewLog func(string),
onCopyCommand func(string),
bgColor, textColor color.Color,
activeProgress *[]*StripedProgress,
) fyne.CanvasObject {
// Status color
statusColor := GetStatusColor(job.Status)
@ -328,8 +325,6 @@ func buildJobItem(
if job.Status == queue.JobStatusRunning {
progress.SetActivity(job.Progress <= 0.01)
progress.StartAnimation()
// Track active progress to stop animation on next refresh (prevents goroutine leaks)
*activeProgress = append(*activeProgress, progress)
} else {
progress.SetActivity(false)
progress.StopAnimation()

41
main.go
View File

@ -986,7 +986,6 @@ type appState struct {
queueAutoRefreshStop chan struct{}
queueAutoRefreshRunning bool
queueActiveProgress []*ui.StripedProgress // Track active progress animations to prevent goroutine leaks
// Main menu refresh throttling
mainMenuLastRefresh time.Time
@ -1782,16 +1781,7 @@ func (s *appState) refreshQueueView() {
}}, jobs...)
}
// CRITICAL: Stop all active progress animations before rebuilding to prevent goroutine leaks
// Each refresh creates new StripedProgress widgets, and old animation goroutines must be stopped
for _, progress := range s.queueActiveProgress {
if progress != nil {
progress.StopAnimation()
}
}
s.queueActiveProgress = nil
view, scroll, activeProgress := ui.BuildQueueView(
view, scroll := ui.BuildQueueView(
jobs,
func() { // onBack
// Stop auto-refresh before navigating away for snappy response
@ -1948,9 +1938,6 @@ func (s *appState) refreshQueueView() {
}()
}
// Store active progress bars to stop them on next refresh
s.queueActiveProgress = activeProgress
s.setContent(container.NewPadded(view))
}
@ -1997,14 +1984,6 @@ func (s *appState) stopQueueAutoRefresh() {
}
s.queueAutoRefreshStop = nil
s.queueAutoRefreshRunning = false
// Stop all active progress animations to prevent goroutine leaks when leaving queue view
for _, progress := range s.queueActiveProgress {
if progress != nil {
progress.StopAnimation()
}
}
s.queueActiveProgress = nil
}
// addConvertToQueue adds a conversion job to the queue
@ -6876,31 +6855,21 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
settingsContent.Hide()
settingsVisible := false
toggleSettingsLabel := widget.NewLabel("Show Batch Settings")
toggleSettingsLabel.Wrapping = fyne.TextWrapWord
toggleSettingsLabel.Alignment = fyne.TextAlignCenter
var toggleSettingsBtn *widget.Button
toggleSettingsBtn = widget.NewButton("", func() {
toggleSettingsBtn = widget.NewButton("Show Batch Settings", func() {
if settingsVisible {
settingsContent.Hide()
toggleSettingsLabel.SetText("Show Batch Settings")
toggleSettingsBtn.SetText("Show Batch Settings")
} else {
settingsContent.Show()
toggleSettingsLabel.SetText("Hide Batch Settings")
toggleSettingsBtn.SetText("Hide Batch Settings")
}
settingsVisible = !settingsVisible
})
toggleSettingsBtn.Importance = widget.LowImportance
// Replace button text with wrapped label
toggleSettingsBtnWithLabel := container.NewStack(
toggleSettingsBtn,
container.NewPadded(toggleSettingsLabel),
)
settingsBox := container.NewVBox(
toggleSettingsBtnWithLabel,
toggleSettingsBtn,
settingsContent,
widget.NewSeparator(),
)