Crash on load if percussion staff with no drumset uses custom notehead

• May 11, 2020 - 16:38
Reported version
S2 - Critical

Steps to reproduce: try to open file
Expected behavior: file opens
Actual behavior: Musescore crashes
Operating system: Windows 7 Home Premium

I've read the instructions for creating a new issue, but being new to Musescore, I'm out of my depth. If you'll please see: , I've been advised to create a new issue here.

Here's the stack trace another user created:
1 Ms::Drumset::noteHeads drumset.h 74 0xfcb832
2 Ms::Note::noteHead note.cpp 863 0x99da62
3 Ms::Note::stemUpSE note.cpp 999 0x99e0a0
4 Ms::Stem::layout stem.cpp 110 0xa26337
5 Ms::Stem::setLen stem.cpp 131 0xa26549
6 Ms::Chord::layoutStem1 chord.cpp 1499 0x8b8f7a
7 Ms::Score::getNextMeasure layout.cpp 2730 0x966e3c
8 Ms::Score::collectLinearSystem layoutlinear.cpp 177 0xb50d01
9 Ms::Score::layoutLinear layoutlinear.cpp 192 0xb50d98
10 Ms::Score::doLayoutRange layout.cpp 4498 0x971ecc
11 Ms::Score::update cmd.cpp 302 0xa9a776
12 Ms::Score::update score.h 750 0xea573a
13 Ms::readScore file.cpp 2491 0x4c3b22
14 Ms::MuseScore::readScore file.cpp 383 0x4b04dc
15 Ms::MuseScore::dropEvent musescore.cpp 2906 0x419f1c
16 QWidget::event(QEvent *) 0x2a935f18
17 QMainWindow::event(QEvent *) 0x2aa24feb
18 QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x2a8f7bdc
19 QApplication::notify(QObject *, QEvent *) 0x2a8ffb04
20 QCoreApplication::forwardEvent(QObject *, QEvent *, QEvent *) 0x68a68fe8



Severity S1 - Blocker S2 - Critical

Crash confirmed (and stack trace actually mine ;-))
but doesn't prevent you from using MuseScore at all, just that one score, so not a Blocker

Title File crashes Musescore (can't be opened) Crash on load if percussion staff with no drumset uses custom notehead

The crash comes because there is a percussion staff that has lost its drumset definition, and a custom notehead is called for. No immediate crash without the custom notehead it seems, but the staff won't make sense either, and will likely cause problems later.

Not sure the best way to deal with these problems is. It's easy to make a staff lose its drumset, just uncheck "Use drumset" in the Mixer. Why is that even a thing?

It's easy enough to avoid the crash by checking for a null drumset when handling these custom noteheads in Note::noteHead() and returning some reasonable default instead. Probably better to detect load of a percussion staff with no drumset, though, and create a default one?

Status PR created fixed

Fixed in branch 3.x, commit 340a120b18

_fix #305293: crash on load of score with missing drumset


We have many crashes with a stack trace showing a bad drumset
when calculating a custom notehead.
I don't know how these scores got into this state
(unless the user deliberately unchecked Drumset in the Mixer),
but I know we can prevent the crash
by returning a default notehead when the drumset is missing.
The drumset will still be missing,
so the user will need to do a change isntrument to set it up again,
but it beats a crash._