Pasting note on multi-voice upstem note causes crash

• Aug 3, 2011 - 03:00
Type
Functional
Severity
S2 - Critical
Status
closed
Project

1. Create score.
2. Enable 'Note Entry'.
3. Select Voice 1.
4. Enter crotchet on F (above middle C).
5. Select Voice 2.
6. In the next bar, enter crotchet on F (above middle C).
7. Flip stem direction of Voice 2 crotchet to upstem.
8. Disable 'Note Entry'.
9. Click note head of Voice 1 crotchet.
10. Copy.
11. Click note head of Voice 2 crotchet.
12. Paste.

Result: Crash.

Using MuseScore 2.0 Nightly Build (4631) - Mac 10.6.8.


Comments

You don't need to create the situation from scratch, you can use the enclosed score.

Just try to copy the note from bar 1 onto the one in bar 2.

Investigation:

While in Score::cmdPaste we receive debug "ChordRest::add: unknown element Note".

Stepping out back into ScoreView::normalPaste() we get a crash in Score::endCmd(), which calls Score::end2().

In there the crash happens in Score::doLayout() somewhere after this block of code:
layoutStage1(); // compute note head lines and accidentals
layoutStage2(); // beam notes, finally decide if chord is up/down
layoutStage3(); // compute note head horizontal positions
layoutSystems(); // create list of systems
layoutPages(); // create list of pages

Debug console shows:
ASSERT: "!isEmpty()" in file C:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore/qlist.h, line 272

From qlist.h we see:
272: const T& last() const { Q_ASSERT(!isEmpty()); return at(count() - 1); }

So someone calls last() on an empty list. To be continued.

Further investigation:

With a message handler installed one can catch the crash easily.

It comes from Chord::layoutStem() in chord.cpp.
Note* upnote = upNote();
Note* downnote = downNote();
The notes array is empty, so QList<*Note>::last aborts on a Q_ASSERT.

Title [Trunk] Pasting note on multi-voice upstem note causes crash Pasting note on multi-voice upstem note causes crash
Status (old) active fixed

I can't reproduce now.

Using MuseScore 2.0 Nightly Build (3a23fc9) - Mac 10.7.5.