Crash on ending score playback

• Feb 26, 2019 - 19:28
Reported version
3.0
Type
Functional
Frequency
Few
Severity
S2 - Critical
Reproducibility
Randomly
Status
closed
Regression
Yes
Workaround
No
Project

3.0, latest master, Ubuntu 18.04 LTS, ALSA. Crash ref: EDITOR-S

Reproduce:

open attached score. Play from anywhere, wait for playback to complete.

Result: crash

The stack trace is:

MuseScore3.exe 0x1407bff4e Ms::RepeatList::tick2utick(int) (c:\musescore\libmscore\repeatlist.cpp:224)
1 MuseScore3.exe 0x14068f91b Ms::Score::lastMeasure() (c:\musescore\libmscore\score.cpp:1681)
2 MuseScore3.exe 0x1402e8bff Ms::Seq::process(unsigned int,float *) (c:\musescore\mscore\seq.cpp:775)


Comments

I don't know how to fix this, mainly since I can't reproduce it. But I think it would be fixed by updating the RepeatList to use fractions instead of ticks. At the moment, we're converting from fractions to ticks and then doing some arithmetic with that. This leads to inconsistencies appearing, such as us trying to find things at the last tick + 1, which doesn't exist.

This can be reproduced also when using chord playback with playback behavior "until next chord symbol", or "until measure end" if the chord is in the last measure.
See https://musescore.org/en/node/305134#comment-998256 and https://musescore.org/en/node/305134#comment-998362.
It hits an assert Q_ASSERT(tick <= lastMeasure()->endTick()); at line 3742 of libmscore/score.cpp.
The tick is set at line 476 of mscore/seq.cpp.

Back trace (only relevant part; it is the same for the file in this issue and the case of chord playback):
- 5 0x000055555ed1daf3 in Ms::MasterScore::setPos(Ms::POS, Ms::Fraction) (this=0x62c0000e8200, pos=Ms::POS::CURRENT, tick=...) at libmscore/score.cpp:3742
- 6 0x000055555c91d6dc in Ms::Score::setPos(Ms::POS, Ms::Fraction) (this=0x62c0000e8200, pos=Ms::POS::CURRENT, tick=...) at libmscore/score.h:1451
- 7 0x000055555c91d3b4 in Ms::Score::setPlayPos(Ms::Fraction const&) (this=0x62c0000e8200, tick=...) at libmscore/score.h:897
- 8 0x000055555c8fa057 in Ms::Seq::guiStop() (this=0x7fffc37ec800) at mscore/seq.cpp:477
- 9 0x000055555c8faa2d in Ms::Seq::seqMessage(int, int) (this=0x7fffc37ec800, msg=50, arg=0) at mscore/seq.cpp:507
- 10 0x000055555d230d29 in Ms::Seq::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x7fffc37ec800, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x60300079c7b0) at build.debug/mscore/mscoreapp_autogen/EWIEGA46WW/moc_seq.cpp:160

I was able to reproduce your issue:

1) Factory settings
2) New score.
3) new note (any length) in last measure
4) add a sustain pedal to it.
5) play. It should crash when reaching the end.

Proof:

1.gif

Attachment Size
1.gif 1.45 MB
Fix version
3.5.1