Volta attached to non-top staff deleted when correspond staff is removed
1. Open this
score.
2. 'Instruments...'
3. Click on bottom stave.
4. 'Remove'.
5. 'OK'.
Result: Crash.
Note: See attached log.
Using MuseScore 2.0 Nightly Build (025f37c) - Mac 10.7.5.
(Thanks to Chistabo .)
Attachment | Size |
---|---|
Removing stave causes crash (Log).txt | 61.51 KB |
Comments
Win7 Ent. 64bit too
The crash is tightly related to the presence of voltas.
Indeed, if the voltas are deleted before removing the staff, everything works fine.
The same crash happens with the following steps:
Note that if the volta is added to a measure of the first staff (i.e. the mouse is released when over the first staff) there is no crash and everything works as expected.
Attached the address sanitizer log for the original bug report. The staffIdx is 1 and score()->staff(staffIdx) at line 1001 of libmscore\system.cpp gives 0 (no staff at staffIdx):
if (all || (score()->staff(staffIdx)->show() && v) || (spanner->type() == Element::VOLTA))
Trying to solve this with pull request:
https://github.com/musescore/MuseScore/pull/481
This pull request imposes track=0 to voltae, i.e. it attaches the voltae to voice 0 of the first staff. It works in reading old files and to newly added voltae.
I don't know if Travis tests will be ok.
Edit: It seems that the Travis build is ok :-)
You and Travis are cool.
Fixed in 943c7e7b2a
Unfortunately, still active, but with slightly different steps:
Moreover, if the bottom staff is removed, there is no crash, but one (actually two, because there are two overlapping voltae in the original file) volta disappear. This is due to 943c7e7b2
The crash is due to the fact that the volta attached to staff 1 is kept, while the volta attached to staff 0 is deleted, but staff 0 is deleted and the old staff 1 becomes staff 0, so the reference to staff 1 no more exists.
I still propose to automatically link every volta to the first staff of the first instrument: there will always be a first staff (staff at position 0), even if all the other staves are deleted (it is impossible to make a score empty of instruments).
I propose that voltae are not deleted like other spanners (so they are not lost when one staff is removed).
Edit: I was forgetting: Windows 8, commit 528d2976c2 (self-compiled)
Well, it is possible to create score without staves.
But it'd be pretty pointless
I cannot reproduce a crash using the steps in #6.
I tried as well and I can't reproduce the crash.
However, there is still something which does not work as expected:
Openthis file: there is one 1. volta at measure 23 and two overlapping 2. voltae at measure 24.
Now, if you go to Add -> Instruments... and remove the TOP staff, one of the two 2. voltae disappears.
Otherwise, if you remove the BOTTOM staff, the 1. volta and one of the 2. voltae disappear.
In principle, information is disappearing (that's why I am not lowering the priority for now). In particular, in the second scenario, the missing 1. volta means a wrong score for the performer reading the score.
The pull request I proposed for this bug is no longer valid (the code has changed a lot), but I still think that we should attach voltae only to the first staff (and therefore put the voltae from an imported 1.3 files to the first staff, even if they were attached to other staves) and we should pay particular attention when staves are removed (in particular, if we decide to attach them to the first staff, we should avoid to delete them if the first staff is removed, but instead attach them to the new first staff).
Whilst not reproducible using the original steps, it is if you click the top stave, in step 3.
Using MuseScore 2.0 Nightly Build (ab14241) - Mac 10.7.5.
Are you sure? Using the El Nuevo Dia score you originally uploaded? I can remove either staff with no crash. However, if I remove the top staff, certain items attached to the top staff are left orphaned and floating in the wrong place - like the initial tempo marking. And as ABL mentions, some of the volta disappear depending on which staff you remove.
Yes - it could be operating system specific?
https://github.com/musescore/MuseScore/pull/481 is still open?
Ok... so in 22ec44fe8a
So the crash is fixed. The remaining bug is about the Volta being deleted when the staff associated with it is removed. We could fix it as ABL proposed in his pull request by setting the volta track to 0 when we read it from the file. And by setting the track to 0 for all spanner anchored to Measure, currently only Voltas. Any other opinion?
I also cannot reproduce any of the above crashes, under Windows 8.1 or Linux Mint 13 (with address sanitizer enabled), commit 22ec44fe (self-compiled).
At the moment, the solution of setting all measure-anchored spanners on staff 0 will not completely prevent them from deletion, because after 943c7e7b2 deleting staff 0 deletes the associated spanners. We could set an exception for measure-anchored spanners so that they are not deleted an remain attached to staff 0 (which I think cannot be deleted in version 2.0, at the moment).