You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix crash during project loading when sample snapping is enabled - #12569
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
TimelineContext now constructs its SnapTimeFormatter during object construction instead of in init(). The formatter constructor now accepts a muse::Contextable pointer. Tests cover sample snapping before initialization, guideline visibility, position conversion and single-step behavior at 44,100 Hz, and independent snapping with 44,100 Hz and 48,000 Hz contexts.
The initialization change is covered by focused pre-initialization snapping tests, with no identified merge-blocking risk.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly identifies the main change: preventing a crash during project loading when sample snapping is enabled.
Description check
The description provides the linked issue, motivation, and required checklist responses. The recommended local-build checkbox is unchecked, but this is non-critical.
Linked Issues check
Issue #12564 reports a crash when a project is reopened with snapping to samples enabled. The crash cause is that TimelineContext::init() created m_snapTimeFormatter, so snap calls made before `in…
Out of Scope Changes check
The whole-PR diff against the merge base changes only files under src/projectscene. Each file relates to the crash fix for #12564: - timelinecontext.cpp: moves formatter creation from init() to …
Full details: Linked Issues check
Explanation
Issue #12564 reports a crash when a project is reopened with snapping to samples enabled. The crash cause is that TimelineContext::init() created m_snapTimeFormatter, so snap calls made before init() used a null formatter. At the reviewed head (87499d9), the whole-PR diff against the merge base (6b7f32a) shows these changes:
timelinecontext.cpp: m_snapTimeFormatter is now created in the TimelineContext constructor member initializer list, using this. The creation in init() is removed. timelinecontext.h declares m_snapTimeFormatter as std::shared_ptr<SnapTimeFormatter>, so the member exists.
snaptimeformatter.h: the constructor now takes const muse::Contextable*. This matches construction from this.
snaptestaccess.h: the test wiring no longer creates the formatter. The formatter now comes from TimelineContext construction.
snaptimeformatter_tests.cpp: the fixture constructs the formatter with a muse::Contextable.
findguideline_tests.cpp: SamplesSnapBeforeInit covers snapping before init(), and SamplesSnapBeforeInit_UsesEachWindowSampleRate covers independent 44,100 Hz and 48,000 Hz contexts.
The formatter is non-null from construction onward, so the reported crash path is covered. The issue has no non-coding requirements.
Limitations: the build and tests were not run. The muse::Contextable(const Contextable*) overload and any other SnapTimeFormatter constructor callers were not verified in this review. The previous-to-head diff also contains unrelated CI, BUILDING.md, and au3 import changes. These come from base movement and are outside the whole-PR scope.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base changes only files under src/projectscene. Each file relates to the crash fix for #12564:
timelinecontext.cpp: moves formatter creation from init() to the constructor. This is the fix.
snaptimeformatter.h: changes the constructor parameter type to const muse::Contextable*. This is required for construction from this.
snaptestaccess.h and snaptimeformatter_tests.cpp: update test construction to the new ownership and signature. These are supporting test changes.
findguideline_tests.cpp: adds regression tests for the pre-init and multi-context cases. It also adds test-only includes and a PlayRegionController setup needed by those tests.
The previous-to-head diff shows unrelated CI, documentation, and au3 changes. These are outside the whole-PR diff and are not part of this PR's changes. No unrelated behavior change appears in the whole-PR evidence.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/musescore.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #12564
snap formatter was initialized after the first use
Recommended: