Tempo line click and drag to beginning of score crash
Issue type
Crash or freeze
Bug description
If you click/drag the tail of a tempo line and send it to the beginning of the score, MuseScore crashes.
In Master, not 4.3.1
Steps to reproduce
- Make a score with a tempo line (rit.../acel.../etc)
- Click and drag the end of the line to the beginning of the score
- Crash
Screenshots/Screen recordings
https://github.com/musescore/MuseScore/assets/69917893/f1300d90-4ae1-421c-8fc5-2e98943f0076
MuseScore Version
OS: Windows 11 Version 2009 or later, Arch.: x86_64, MuseScore Studio version (64-bit): 4.4.0-241420305, revision: github-musescore-musescore-449a64e
Regression
Yes, this used to work in a previous version of MuseScore 4.x
Operating system
All
Additional context
Alright, I’ve investigated this but haven’t found a satisfying fix just yet. Posting my findings for now, will return to this later with fresh eyes.
The moment the right grip is dragged beyond the problematic point, the LineSegment is put into some sort of invalid state and disappears. This isn’t actually the point where crash happens - if you’re quick enough you can release the drag and you’re left with an invisible line segment (which can be brought back if you insert a measure before the first).
We then get a layout call which resets the explicit parent. Whatever the “invalid state” is exactly (I'm still figuring this out), it prevents the LineSegment from being re-assigned an explicit parent during the layout. This is eventually what causes the crash at the next drag event (sys is null in findSegmentForGrip due to no explicit parent).
I can no longer reproduce this in the latest nightly. @zacjansheski @mathesoncalum could you perhaps please cross-check and verify?
Dragging to the top menu crashes the app.
https://github.com/user-attachments/assets/de81dc44-2fc3-42bf-b673-367a2e0d9575