Crash rewriting measures that contain notes with null lyrics in score with parts

• Mar 19, 2015 - 05:06
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Ubuntu 14.04, GIT commit: 278e1e7

First reported by Jojo on IRC with one particular score, but I have simple steps to reproduce from scratch.

1) new score, 4/4
2) add note
3) select note, Ctrl+L
4) hit Enter, then enter a lyrics (so, in verse 2, with nothing in verse 1)
5) generate parts
6) change initial time signature to 3/4

Result: crash. We are trying to clear the lyrics from the note, and dereference a null pointer here:

https://github.com/musescore/MuseScore/blob/master/libmscore/excerpt.cp…

Should hopefully be just a matter of checking for null first; we're just deleting the lyrics anyhow.


Comments

Actually, the link above is the wrong line, that's the almost identical function for linked staves in the same score (cloneStaff). Same bug there too, I guess. The function for linked parts is cloneStaff2.

And looking further, I don't think this code even belongs in cloneStaff2. It has the effect of removing lyrics from the linked part. i suspect this code was intended for cloneStaff, since lyrics are never cloned within a score, but this code should have been stripped out for cloneStaff2.

Status (old) active patch (code needs review)

Here's a PR to fix this:

https://github.com/musescore/MuseScore/pull/1900

I notice that after fixing the crash, lyrics are removed from the part on the time signature change. Turns out the chunk of code that was crashing shouldn't have been there in the first place. I wrote that piece code in the first , but probably should have put it in cloneStaff only (and made it crash-proof). I'm still wanting to look at this further in the morning, but I *think* the code in my PR is good.