Fix assert on broken slurs#34041
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughThis change routes Changes
Sequence Diagram(s)Diagrams are included above in the hidden review stack artifact. Related issues: Not specified. Related PRs: Not specified. Suggested labels: engraving, import, bug-fix Suggested reviewers: Not specified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsLinked 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp (1)
8338-8341: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider routing cleanup through
setEndElement/setStartElementfor consistency with the centralized registration pattern.These three cleanup sites manually call
Chord::removeEndingSpanner/removeStartingSpannerdirectly, duplicating logic thatSpanner::setEndElement(nullptr)/setStartElement(nullptr)already perform (per the cohort's centralization of chord anchor registration inspanner.cpp). CallingnewSlur->setEndElement(nullptr)/newSlur->setStartElement(nullptr)beforedeletewould achieve the same cleanup while staying consistent with the new architecture and avoiding direct coupling toChord's internal spanner-set API from this file.Spanner::setStartElement/setEndElement remove the spanner from the old chord's starting/ending spanner sets and add it to the new chord's corresponding sets. This is exactly the behavior being manually re-implemented here.
Based on the review-stack context describing the intent to centralize anchor registration through the setters (Cohort: "Spanner anchor registration refactor"), this file's direct calls bypass that centralization.
Also applies to: 8350-8353, 8401-8404
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp` around lines 8338 - 8341, The cleanup code for `newSlur` is bypassing the centralized spanner anchor management by calling `Chord::removeEndingSpanner`/`removeStartingSpanner` directly. Update the affected cleanup paths in `importmusicxmlpass2.cpp` to clear anchors via `Spanner::setEndElement(nullptr)` and `Spanner::setStartElement(nullptr)` on `newSlur` before deletion, so the existing registration/removal logic in `spanner.cpp` is used consistently. Keep the behavior the same for all listed cleanup sites while removing the direct `Chord` coupling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp`:
- Around line 8338-8341: The cleanup code for `newSlur` is bypassing the
centralized spanner anchor management by calling
`Chord::removeEndingSpanner`/`removeStartingSpanner` directly. Update the
affected cleanup paths in `importmusicxmlpass2.cpp` to clear anchors via
`Spanner::setEndElement(nullptr)` and `Spanner::setStartElement(nullptr)` on
`newSlur` before deletion, so the existing registration/removal logic in
`spanner.cpp` is used consistently. Keep the behavior the same for all listed
cleanup sites while removing the direct `Chord` coupling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 22e1aea5-3f47-4211-83ea-06a51b176501
📒 Files selected for processing (2)
src/engraving/dom/spanner.cppsrc/importexport/musicxml/internal/import/importmusicxmlpass2.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/engraving/dom/spanner.cpp
When setting m_startElement and m_endElement directly, we do not update references to the spanner in m_starting/endingSpanners
Some MU2 files contain lots of corrupt slurs with starts and no ends. These should be removed from the score after reading the file.
There is also a commit fixing a use after free error.
Spanner::setStart/EndElementdidn't update pointers to the spanner which could be held by aChord.