Crash when creating tuplet out of note with hyphenated / extended lyric

• Nov 21, 2015 - 17:37
S2 - Critical

Pls check this with the attached file:
Open the file , select first note and hit Ctrl-3 to make a triplet.
MuseScore crashes imediately.

GIT commit: f51dc11

Attachment Size
Rockin_Around_the_Christmas_Tree_4.mscz 24.13 KB


Title Crashes on Ctrl-3 as first command Crash when creating tuplet out of note with hyphenated / extended lyric
Status (old) needs info active

Crashes for me on current development build on Ubuntu. The crash occurs trying to draw the current score view, in ScoreView::paint(). I have tracked it down to the root cause: creating the tuplet deletes the note and the lyric attached to it, but the dash is not removed properly. It seems it is deleted but still stays on the list of elements for the page.

Here are steps to reproduce from scratch:

1) my first score
2) enter two quarter notes
3) enter lyrics "hel - lo"
4) click first note
5) ctrl+3

Result: crash

Same thing if you enter a single syllable lyric and an extender (eg, "crash _ _") at step 3 instead of two syllables with hyphen.

EDIT: the fact that we're accessing garbage values (memory that has already been freed) explains why the crash is seen is on some systems but not others. It's basically like an uninitialized variable. But hopefully my description of the cause of the problem is sufficient to allow further debugging even on systems where it doesn't crash.

BTW, I don't think that it is normally "our" job to remove elements from a page's bsp tree when we remove elements. This list is normnally rebuilt from scratch when necessary as far as I know. I think the problem is that in this particular case, it is not - I think it the forcing into note entry mode in Score::cdmCreateTuplet() that ultimately triggers the redraw before we have had a chance to relayout. Probably the solution is to add an explicit call to doLayout() or pehraps just rebuildBspTree() somewhere, like perhaps in Score::removeUnmanaged(), or maybe Score::cmdCreateTuplet() just before we post the "note-input" event.