[Capella import] Crash reading sueno.cap using debug build

• Apr 28, 2013 - 09:20
Type
Functional
Severity
S2 - Critical
Status
closed
Project

When reading sueno.cap (a mazurka by Tarrega downloaded from hausmusik.ch) mscore terminates with the message:
ASSERT: "!isEmpty()" in file /usr/include/QtCore/qlist.h, line 285
Aborted.

A normal build reads sueno.cap without obvious problems.

Stack trace:
#0 0xb4360245 in raise () from /lib/libc.so.6
#1 0xb4361ac3 in abort () from /lib/libc.so.6
#2 0xb4783e6e in qt_message_output(QtMsgType, char const*) () from /usr/lib/libQtCore.so.4
#3 0xb4784069 in ?? () from /usr/lib/libQtCore.so.4
#4 0xb4784188 in qFatal(char const*, ...) () from /usr/lib/libQtCore.so.4
#5 0xb4784205 in qt_assert(char const*, char const*, int) () from /usr/lib/libQtCore.so.4
#6 0x085d973d in QList::last (this=0x94a1ef4) at /usr/include/QtCore/qlist.h:285
#7 0x085d8afd in QList::back (this=0x94a1ef4) at /usr/include/QtCore/qlist.h:301
#8 0x086bbf29 in Score::layoutStage2 (this=0x9473fe8) at /home/lvi/dev/MuseScore/libmscore/layout.cpp:448
#9 0x086bc907 in Score::doLayout (this=0x9473fe8) at /home/lvi/dev/MuseScore/libmscore/layout.cpp:601
#10 0x08312eb1 in ScoreView::setScore (this=0x93fec90, s=0x9473fe8)
at /home/lvi/dev/MuseScore/mscore/scoreview.cpp:916
#11 0x084add77 in ScoreTab::setCurrent (this=0x933bc98, n=0) at /home/lvi/dev/MuseScore/mscore/scoretab.cpp:151
#12 0x084ae962 in ScoreTab::setCurrentIndex (this=0x933bc98, idx=0)
at /home/lvi/dev/MuseScore/mscore/scoretab.cpp:317
#13 0x083cec82 in MuseScore::setCurrentView (this=0x92ee7d8, tabIdx=0, idx=0)
at /home/lvi/dev/MuseScore/mscore/musescore.cpp:1398
#14 0x083d1545 in loadScores (argv=...) at /home/lvi/dev/MuseScore/mscore/musescore.cpp:1998


Comments

It would be most helpful if you could find (preferably short) file(s) demonstrating the issue.
Please be careful not to attach copyrighted material to messages this site.

The attached examples are all classical music scores (Schubert, Beethoven, Haendel), so there should be no copyright issues (I think). In the zipped folder you will find the .cap files and the relative .pdf files obtained by opening and printing the file with capella reader.
All of these give to my debug build the "!isEmpty()" crash.
The problem originates from "cr->tuplet()->elements().back()" instruction since in capella.cpp tuplets are created and added to the measure, notes are linked to the tuplet, but the tuplet notes' list is not filled.
In particular, I think that the instructions:
if (tuplet)
tuplet->add(rest);
and
if (tuplet)
tuplet->add(chord);
are missing just after the "s->add(rest);" and "s->add(chord);" instructions.
Moreover, in the case of rests, also the instruction "rest->setTuplet(tuplet);" is missing.

Tuplet import should be improved: at the moment only triplets made of notes with the same duration are imported. The extension to n-tuplets of notes with the same duration is easy. If I understood correctly, the tupletCount should correspond to fraction:
tupletCount 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
denom 1 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8
numer 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
and for isTripartite case (o->tripartite = compound meter)
tupletCount 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
denom 1 1 3 3 3 3 3 6 6 6 6 6 12 12 12 12
numer 1 1 4 3 4 5 6 7 8 9 10 11 12 13 14 15
(but these numbers should be checked against examples)

I think isProlonging (o->isProlonging) is probably used for tuplets spanning over two measures, but I am not sure (I have not found examples yet).

However, the problem is for tuplets made of notes with different value, for example a triplet of 1/8 with note durations 1/8 + 1/16 + 1/16 + 1/8.
For what I see, capella files do not have "begin tuplet" and "end tuplet" signals, so the importer just has to guess which kind of tuplet it is (relying on the tupletCount).
For example, 1/8 + 1/16 + 1/16 + 1/8 could be interpreted as two triplets of 1/16,
and 1/16 + 1/16 + 1/8 + 1/8 and 1/8 + 1/8 + 1/16 + 1/16 are more difficult to be interpreted by an importer as triplets of base note 1/8.

Attachment Size
notisEmpty_bug.zip 844.04 KB