fix #51391: crash on clone of null lyric #1900
Merged
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.
Not sure I'm ready to merge this, but I wanted to see the result of Travis tests. I'm still sorting out the relationship between cloneStaff and cloneStaff2. Although the code is very similar, it seems their purpsoes are very different. cloneStaff gets called when adding a linked staff to a score, cloneStaff2 gets called when rewriting a linked part after a time signature change. It also seems a good chunk of cloneStaff2 is not relevant - annotations in particular are not present in the source, as they are handled separately.
The code involving lyrics specifically I added a few months back, and I think I should have added it to cloneStaff only, but didn't understand the purpose of cloneStaff2 so I added it there too. The result is that rewriting time signatures deletes lyrics in parts. I can't see any reason to keep that code.