Split a measure in direct relation (time duration) with some tuplets owned to another staff causes crash

• Sep 6, 2015 - 08:57
Reported version
S2 - Critical

Nightly 35b9f49/ Windows7

1) Open this file: file test.mscz

2) Select the half rest in top staff, 1st measure -> create a triplet: Ctrl +3

3) Exit note input mode

4) Select the second note (E) in the bass clef staff -> Edit -> Measure -> Split measure

Result: corruption.
By continuing, and by clicking between the two barlines closer the time signature, you get a crash. Remark also: by hitting "M" (before the crash step), you get 3 mm rests.

- As expected, it works by splitting the measure since the third time (bass clef, G note)

- Notice also that by creating a quadruplet (Ctrl + 4), or sextuplet, and others (which are "binary-binary relation" I guess) and repeating the step #4, you receive a warning ("cannot split tuplet"). But not with the triplet, quintuplet, "Other"... with the corruption result.

- Issue related to this thread, and attached file in comment #4: #72041: Handle measure with too many notes to fit on a single system


For the record, I can reproduce exactly the same behaviour since May 2014: 56177c3
After splitting:
split result.jpg

- Also slight change title (not all tuplets, but some of them, depending the "category"as mentioned in the initial message), and shorter (the crash is obviously the consequence of the corruption)

The original report mentioned a crash, and I reproduce that with his file. In that case, it seems to be the nested tuplets (tuplet within a tuplet) that causes a problem. The crash is actually not the *result* of the corruption - MuseScore simply recognizes it is being asked to do something it wasn't prepared to do, and it decides to give up rather than try. The crash is actually a call to qFatal(), which is to see, something of a "planned" crash.

I do not have the practice of these nested tuplets. But yes, if you do this in the test file (in the second measure), you get a crash in first intention by splitting the measure from the second note (E), bass clef staff: file test_2.mscz

Stack trace:
1 Ms::Segment::isChordRestType segment.h 243 0xc231a0
2 Ms::Score::computeMinWidth layout.cpp 2097 0x7f05c8
3 Ms::Score::collectSystem layout.cpp 3110 0x7f50a2
4 Ms::Score::doLayout layout.cpp 3663 0x7f74c1
5 Ms::Score::update cmd.cpp 191 0x774fc9
6 Ms::Score::endCmd cmd.cpp 166 0x774e2d
7 Ms::Score::cmdSplitMeasure splitMeasure.cpp 52 0x7e8417
8 Ms::ScoreView::cmd scoreview.cpp 3047 0x411aa3
9 Ms::MuseScore::cmd musescore.cpp 4441 0x498d25
10 Ms::MuseScore::cmd musescore.cpp 4056 0x496e94
11 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 825 0x6881f6
12 ZN11QMetaObject8activateEP7QObjectiiPPv 0x68a07a62
13 Ms::ScoreTab::actionTriggered moc_scoretab.cpp 193 0x68e335
14 Ms::ScoreTab::qt_static_metacall moc_scoretab.cpp 95 0x68e007
15 ZN11QMetaObject8activateEP7QObjectiiPPv 0x68a07a62
16 ZN12QActionGroup7hoveredEP7QAction 0x195e5295
17 ?? 0x1f941060
18 ZN7QAction8activateENS_11ActionEventE 0x195e4248
19 ?? 0x28c928

Status (old) fixed needs info
Status fixed needs info

By which way do you split the measure?

Here with a747b2b
and this new test file: test copy.mscz

1) Load the test file
2) Select the E (second note second staff)
3) Ctrl + Del

Result: crash

Title Split a measure in direct relation (time duration) with some tuplets owned to another staff causes corruption Split a measure in direct relation (time duration) with some tuplets owned to another staff causes crash
Status (old) needs info active
Status needs info active

Okay, different things here:

A) Okay, you use a shortcut to split a measure: I wasn't aware of that.
Nevertheless, I get a crash with the same file or another identical: test1.mscz

1) Load the file
2) Select the second note second staff -> shortcut to split the measure (eg L, for me)
Result: as expected
3) Select the third note second staff -> shortcut to split.
Result: crash

B) This issue was reported since a while (almost two years). At that time, I was confused by the new features and the new ways (in particular with Ctrl + Del) to achieve this:
ie if I understand well and if nothing as changed:
- join = delete a barline (with Ctrl + Del)
- split : add a barline (with shortcut, or with hold on Ctlr + drag a barline on a note). On a rest, it fails. Inter alia unexpected and various things/scenarios hence eg the crash described in the previous comment.

Status (old) active patch (code needs review)
Status active  

test1.mscz uses the (now unsupported) museScore version="3.00". To produce the crash, use the test file at the top of this bug report, and be sure to create a triplet from the half note rest before splitting the measure twice.

The reason for the crash has nothing to do with the original problem, which was fixed long ago. We are trying to access the back of a list without first checking to see if the list is empty. See https://github.com/musescore/MuseScore/pull/4013 for a patch.

Status (old) patch (code needs review) fixed
Status fixed

Fixed in branch master, commit 57bb9be5b8

fix #75991: Split a measure in direct relation (time duration) with some tuplets owned to another staff causes crash

Fixed in branch master, commit b3feb3a971

Merge pull request #4013 from mattmcclinch/75991-split-measure

fix #75991: Split a measure in direct relation (time duration) with some tuplets owned to another staff causes crash