Fix score corruption after undoing local time signature deletion - #34845
Fix score corruption after undoing local time signature deletion#348450xMashiro wants to merge 1 commit into
Conversation
Register and unregister staff time signatures when a complete segment is added or removed. Undo can restore the segment without visiting Segment::add, leaving the restored local meter absent from the staff map. Add a regression covering deletion from the full score and linked part, undo, redo, score integrity, and MSCZ save/reopen. All 16 native time signature tests pass; the new test fails on the unmodified upstream baseline. Desktop delete/undo/save reproduces the corruption warning before the fix and saves successfully after it. Resolves: musescore#29789
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
Priority: ➖ Normal — Impact reflects medium issue severity. Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Local time signatures are now registered when restored and unregistered when removed, preventing stale timing state after deletion and undo. The covered score, excerpt, undo/redo, and persistence flows indicate the corruption fix is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped 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. Comment |
Resolves: #29789
Deleting a local time signature and undoing restores the visible signature but can leave the full-score staff time-signature map at the preceding meter. Saving then reports an incomplete measure and score corruption.
Register and unregister time signatures when
Measureadds or removes a complete time-signature segment. Restoring a segment during undo does not pass through the individual-item registration inSegment::add, so this keeps both mutation paths consistent.The regression uses the existing
timeSig-11.msczfixture: Clarinet measure 2 has local 7/8 and measure 3 has local 5/4. It covers deletion from the full score and linked part, undo, redo, integrity validation, and MSCZ save/reopen including excerpts.Validation
a64e0d0c8725a89af2b4b9f8e058a75be20c01d3: the new regression fails. The restored object is 5/4, while the full-score staff lookup remains 7/8; the save integrity check reports incomplete measures.Engraving_TimesigTests.*).git diff --checkpass.Reproduction instructions, scores and native logs
Before video:
local-timesig-before.mp4
After video:
local-timesig-after.mp4
Related work
This addresses the existing report #29789, rather than claiming a newly discovered issue. #26100 provides related local-meter work and the reused fixture. #17418 concerns deleting a whole measure, and #11941 concerns an initial time signature. No matching active fix PR was found in the issue timeline and repository searches; this is not an exhaustive claim about all prior work.
Contributor checklist