Musescore crashes when selecting all notes and switch to voice 1

• May 27, 2015 - 03:15
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Hi! I want to report a bug. When i've selected all (CTRL+A), and then press voice 1 (CTRL+ALT+1) the program just stop working!
Sorry about my english, is not my language.

Thanks for this awesome music software!!


Comments

Your English seems fine. Please give more details: what operating system? which release of MuseScore? Version number is contained in "help" "about". :)

:) Thanks! Windows 8.1 musescore 2.0.1 V. b25f81d
When i select a whole staff with two or more voices, and then click to select Voice 1, that is when it crashes.

(I hate my english)

Can you attach the specific score you are having problems with? I tried it with several scores and did not see any proboems, so it must be something special about your score.

Status (old) needs info active

I could reproduce in the lastest self built from master.

Open score with voices and linked parts
Select all, Strg+A
Switch to voice 1, Strg+Alt+1

Stack trace:
0 Ms::Score::parentScore score.h 922 0xbc2114
1 Ms::Score::rootScore score.cpp 1852 0x75a140
2 Ms::Score::undo score.cpp 1863 0x75a161
3 Ms::Score::undo score.cpp 3279 0x75ff65
4 Ms::Score::undoAddElement undo.cpp 980 0x74801e
5 Ms::Score::changeVoice score.cpp 3988 0x7632dc
6 Ms::ScoreView::changeVoice scoreview.cpp 4573 0x419784
7 Ms::ScoreView::cmd scoreview.cpp 2867 0x410a7c
8 Ms::MuseScore::cmd musescore.cpp 4222 0x493b22
9 Ms::MuseScore::cmd musescore.cpp 3867 0x491e3e
10 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 810 0x6a3c0c
11 ZN11QMetaObject8activateEP7QObjectiiPPv 0x68a64e31
12 Ms::ScoreTab::actionTriggered moc_scoretab.cpp 189 0x6a9ca3
13 Ms::ScoreTab::qt_static_metacall moc_scoretab.cpp 94 0x6a9979
14 ZN11QMetaObject8activateEP7QObjectiiPPv 0x68a64e31
15 ZN12QActionGroup7hoveredEP7QAction 0x61dc4b95
16 ?? 0x1e581f70
17 ZN7QAction8activateENS_11ActionEventE 0x61dc3b6e
18 ?? 0x28cde8
19 ??
...

Can't share the score due to copyright, it is a score with parts, on another without parts I could not reproduce and the stack trace seems to indicate a problem with parts, Score::parentScore() dereferences _parentScore and that doesn't seem to be set?!?

Hmm, can't reproduce with another score having linked parts, strange

Can you try removing most of the notes/measures and posting?

Also, it's entirely possibly that it will turn out these are two unrelated bugs. I would still like to see the score from the OP.

Sorry about respondign late! here is 1103 am :) . I´ve attached the score in this message. Don't laugh about the score, is not mine :D i just take it as a XML from noteflight

Attachment Size
November.mscz 20.98 KB

I can't reproduce a crash with either score - at least not on this operation. But see below.

The "November" score is corrupt - which MuseScore warns you about on load - so no big surprise if problems ensue. Do you know how that corruption happened? Was this imported from MusicXML? Using 2.0.1, 2.0, an experimental prerelease build, or something else? The corruption is an eighth rest on beat 2 that should really be a sixteenth rest. The dotted eighth note that follows it overlaps. To fix, you will need to completely remove that measure, then insert a new one and re-enter the notes.

Jojo - the score from the original report does not involve parts, so indeed, if there is a problem here it's probably unrelated.

EDIT: now that's odd, actually, I *do* get a crash, but only later if I close the tab. This is true with either score: the voice operation succeeds - or appears to, anyhow - but then there is a crash in the destructor for a barline when closing the tab. Hard to see how that could be related, but I guess it must be. Probably some sort of memory corruption, which also might explain why I don't see the crash right away.

That November score crashes for me even after having fixed the corruption.

Same stack trace as with my score.

If I in that score select measure 42 (the only that would see a change from the switch to voice 1, as only in that measure there are some notes in different voices but with the same rhythm), and do the Strl+Alt+1, that measure changes, no crash. A subsequent Ctrl+A, Ctrl+Alt+1 then doesn't crash anymore either.
So I guess the crash has to do with that measure 42.
Reminds me of Douglas Adams...

Status (old) active patch (ready to commit)

OK, I finally understand and can reproduce in a very simple score

1) empty score, 4/4
2) any measure, whole note in voice 1, two half notes in voice 2
3) select all
4) Ctrl+Alt+1 to attempt to move to voice 1
5) close score

At step 4, the operation will fail as expected, because there is nowhere to put the notes. But MuseScore crashes on close, always in the same place for me - the barline destructor. And now that I understand the problem, I can see why on some systems the crash might occur at step 4.

The problem is that in trying to determine if I can move the notes, I am doing some operations on elements I am assuming are chordrests even though I haven't tested for that. As a result, any number of bad things can happen when I try processing the barline after casting it to a chordrest.

Looks like I'm also iterating over a list (selection().elements()) that may be modified over the course of the operation, so that too could cause crashes in certain situations.

My PR fixes both of these issues, and thus should address the problems being seen here, even though though the specific symptoms we see differ.

https://github.com/musescore/MuseScore/pull/2097