Skip to content

Fix Show Manager edge cases around timing and previews#2025

Open
cmuellner wants to merge 5 commits into
mcallegari:masterfrom
cmuellner:pr-1955-fixes-p2
Open

Fix Show Manager edge cases around timing and previews#2025
cmuellner wants to merge 5 commits into
mcallegari:masterfrom
cmuellner:pr-1955-fixes-p2

Conversation

@cmuellner
Copy link
Copy Markdown
Contributor

Description

Summary of Changes:

This PR fixes Show Manager reliability issues found while reviewing stale
PR #1955.

The changes allow adjacent timeline items, keep the cursor stable after
time-scale changes, avoid invalid preview marker calculations, and
synchronize audio waveform preview access between painting and preview
generation, and stop preview threads before Audio items are destroyed.
Normal timeline editing and preview rendering behavior is unchanged for
valid items.

Commit Guide

Commit Origin Reproduction / coverage
Show Manager: allow adjacent track items Reported in PR #1955 Reproduce by placing one item exactly at another item's end time; the v4 and QML overlap checks now use half-open intervals.
Show Manager: keep cursor stable when scaling Reported in PR #1955 Reproduce by moving the v4 play cursor, changing the time scale, and observing the previous two-pixel shift.
Show Manager: clamp preview duration markers Reported in PR #1955 Reproduce with zero-duration EFX/RGB Matrix functions, long Sequence fade-out markers, or zero-speed QML audio/video fades.
Show Manager: synchronize audio preview pixmap Independent finding Reproduce by repainting the v4 Show Manager while waveform preview generation replaces the preview pixmap; ThreadSanitizer is the best verification tool.
Show Manager: stop audio preview threads on teardown Independent finding Reproduce by deleting an Audio item or reloading the show while waveform preview generation is still active.

Testing

Automated Coverage:

There is no dedicated Show Manager unit test target in the current tree.

Manual Testing Gaps

Reviewers can smoke-test the affected paths by placing adjacent items on
the same track, changing the v4 timeline scale with a visible cursor,
opening items with zero-duration or long fade markers, and deleting or
reloading an Audio item while waveform preview generation is active.

Additional Notes

The fixes are grouped because they all affect Show Manager timeline or
preview behavior. They are still kept as separate commits for review.

Each commit body contains the full rationale and reproduction details.

Checklist

  • I have read and followed the QLC+ Coding Guidelines.
  • My code adheres to the project's coding style, including:
    • Placing opening braces { on a new line for functions and class definitions.
    • Consistent use of spaces and indentation.
  • I have tested my changes on the following platforms:
    • Linux
    • Windows
    • macOS
  • I have added or updated documentation as necessary.

cmuellner added 5 commits May 14, 2026 12:20
Origin: reported in PR mcallegari#1955.

Reproduce in either the v4 or QML Show Manager by adding a timed item
to a track, then placing a second item on the same track with its start
time exactly equal to the first item's end time. The old inclusive end
checks treated the shared endpoint as overlap and rejected the item.

Use half-open time ranges, `[start, end)`, in both Show Managers so
items only overlap when they share actual time.

No automated regression test exists for this Show Manager GUI path.

Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: reported in PR mcallegari#1955.

Reproduce in the v4 Show Manager by moving the play cursor to a visible
time on the timeline, then changing the time scale. The cursor was
recomputed from its logical time, but the scale-change path added two
pixels that normal cursor movement does not use.

Use the same coordinate convention as moveCursor() when recomputing the
cursor position after a time-scale change.

No automated regression test exists for this Show Manager GUI path.

Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: reported in PR mcallegari#1955.

Reproduce by painting a v4 Show item for a zero-duration EFX or
RGB Matrix function, or by painting a Sequence whose last step has a
long fade-out marker. The loop marker code divided by the underlying
function duration, and the sequence fade-out line could extend past the
item width.

In the QML Show Manager, Audio and Video preview data also emitted fade
markers for zero-speed fades, which produced visible edge markers.

Skip loop markers when the underlying duration is zero, clamp sequence
fade-out markers to the item width, and only emit QML audio/video fade
markers when the fade speed is non-zero.

No automated regression test exists for this Show Manager GUI path.

Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: found while reviewing the PR mcallegari#1955 bug list; not reported in
PR mcallegari#1955.

Reproduce in the v4 Show Manager by adding an Audio item, switching the
waveform preview mode while preview generation is active, and repainting
the timeline at the same time. The paint path read m_preview while the
preview thread could delete and replace the same pointer.

Protect preview replacement and paint access with a mutex. The paint
path copies the current pixmap while holding the lock, then scales and
draws the local copy after releasing it.

No automated regression test exists for this GUI threading path.

Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: independent finding while reviewing the v4 Show Manager audio
preview lifetime.

Reproduce in the v4 Show Manager by adding an Audio item with waveform
preview enabled, switching preview modes to start preview generation,
then deleting the item or reloading the show while generation is still
active. PreviewThread kept a raw AudioItem pointer and could continue
dereferencing it after the item was destroyed.

Track running preview threads on AudioItem, request interruption for
obsolete preview work, and wait for any remaining threads before the
item and preview pixmap are destroyed.

No automated regression test exists for this GUI lifetime path.

Signed-off-by: Christoph Müllner <christophm30@gmail.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 35.004% (-0.03%) from 35.037% — cmuellner:pr-1955-fixes-p2 into mcallegari:master

@mcallegari
Copy link
Copy Markdown
Owner

mcallegari commented May 19, 2026

I take this is AI generated code, but are you actually reproducing each issue and testing if the fix resolves it?
Cause with this change the loopCount calculation doesn't look right to me.

I'm not against AI code contributions as long as they are supervised and tested by humans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants