Fix crash when removing guitar bend hold lines - #34623
Conversation
(cherry picked from commit 850a724)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthrough
🚥 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 |
Ports: #34500
Note: it was discussed in the above 4.7 PR to also call
setGenerated()on theGuitarBendHoldSegments in 5.0, but this involves changes in behaviour, so I decided to leave it alone for this fix.Resolves: #34481
The crash:
GuitarBendHoldis created, owned and destroyed by itsGuitarBend, not by the score. Also,GuitarBend::updateHoldLine()callssetGenerated(true)on it, but not on its segments.Score::deleteItem's default case, which does not really remove the hold line, but aRemoveElementcommand is being created for it.updateHoldLine()deletes the hold line and all its segments.UndoStack::~UndoStack()callscleanup(true)on theRemoveElementcommand, which deletes the already freedGuitarBendHoldSegment.The fix was to add a special switch case to
Score::deleteItemto avoid the step 2 above (so the hold line simply cannot be removed in itself).