Crash after undo of time signature delete in score with spanners

• Aug 28, 2014 - 15:45
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Ubuntu Studio 14.04, GIT commit: 54f4fc3

1) open attached score
2) delete the 2/2 time time signature going into bar 8
3) undo

Result: crash

This is the same score as #30941: Layout changes after Select All response #3. It's possible that whatever is going on here - the crash occurs in SpannerMap::addSpanner - is related to the unusual layout shift described there. I can see looking at the slurs on this piece that they appear to have odd anchors - like they were originally added between two adjacent notes then stretched into position over more notes (as opposed to actually changing the anchor). I doubt that in itself is a contributor to the crash. but it does suggest the score may have other spanner issues.

Attachment Size
Pulchra_es-13.mscz 10.58 KB

Comments

It is also reproducible from scratch.
Attached a minimal crashing example.
Steps:
1- Open the attached file;
NOT FOUND: 1
2- Select and delete the 2/2 time signature;
Note: the slur disappears!
NOT FOUND: 2
3- Undo -> Crash.

Windows 8.1, commit fc6fe02

Additional notes:
The problem happens when the group of measures being rewritten to the new time signature (coming from the previous measures) do not add up to full measures in the new time signature and an additional rest is added.
Could it be that the spanner's ticks are not updated?
It seems that not all time signature combinations give a crash (for example, 4/2 and 2/2 in the example give a crash, and also 8/4 and 4/4, but not 6/4 and 3/4) when the disappearing of the slur happens.

Attachment Size
inizio.png 22.57 KB
fine.png 19.73 KB
minimal_crash.mscx 4.84 KB

My understanding of this issue? I see two issues, distinct!

1) For the first, "Pulchra es", I never could manage to reproduce the crash by selecting only the TimeSig of the first system, Soprano 1 -> Ctrl + X -> Undo

BUT, by selecting, with the Ctrl key, two systems, or more, I can reproduce constantly on the file "Pulchra es"

I can reproduce also with a basic file for two flutes: you see this crash by selecting both
TimeSig -> Ctrl +X -> Undo.

- Select 2 Timesig.mscz

timesig.jpg
Timesig1.jpg

This bug is very former. I can reproduce it on a Nightly from May 19.

-----------------------------------------------------------------------------------

2) For the "Minimal Crash" file, I can not reproduce the crash on the same Nightly and others, including the Beta 1 (and with Windows7 and Windows8).

However, I do see the disappearance of the slur, after Ctlr + X (it returns after Ctrl + Z)

After checking, this issue, with exactly the same file, occurs on August 22.

Between the commit, correct: https://github.com/musescore/MuseScore/commit/3d172d78b30af2a555a0e1480…

and the commit, incorrect: https://github.com/musescore/MuseScore/pull/1196

So, probably (?) here:

- https://github.com/musescore/MuseScore/commit/f2ea47bc3a4ea3fc22a8311b4…

or

- https://github.com/musescore/MuseScore/commit/24facb5918b87c0cc8878b3b4…

Accordingly, should we distinguish these two issues (according my understanding) by two different titles? Something like this?

1. Select two TimeSig, Delete them, and Undo, causes crash.

2. Delete TimeSig causes the slur removal under certain conditions

Attachment Size
timesig.jpg 16.16 KB

My fault, I had to add that the crash fro the minimal example happens only in debug mode since it is triggered by a qFatal instruction which is reached only in debug mode inside function SpannerMap::addSpanner, as Marc was underlining. I think it could probably crash also for you if you launch "nightly.exe -d" (or use MuseScoreNightly\special\debugMode.bat).

The bug about deleting two time signatures at the same time is a different bug, worth of its own bur report.

With the Nighlty October 13 (386775a), and "Special ->Debugmode", I cannot reproduce the crash of "Minimal crash", as you see, with the three steps:

- Select 2/2
select.jpg

- Ctrl X
Ctlr X.jpg

- Ctrl Z
Ctrl Z.jpg

But, with the same process (by Debugmode), I can reproduce the crash with "Pulchra es" by selecting two TimeSig -> Delete -> Undo

Pulchra debumode.jpg
Pulchra debumode1.jpg

EDIT: I would add, to complete, that the presence or not of spanners (I tried with or without) in "Pulchra es" has no cause-effect link. In contrast, with or without spanners, selecting two TimeSig causes a crash.

Attachment Size
select.jpg 13.29 KB
Ctlr X.jpg 13.05 KB
Ctrl Z.jpg 13.34 KB
Pulchra debumode.jpg 13.05 KB
Pulchra debumode1.jpg 16.75 KB

Sorry, the crash happens only for a debug build. Nightly builds are actually release builds.
The qFatal is there to catch possible dangerous behavior: after the undo the score is corrupt. Indeed, when opening the file and looking in the debugger (right-click on one element-> debugger) under "Global" there is one slur with a corresponding SlurSegment in measure 3. After delete and undo, you can see there are two slur entries under Global, which correspond to one SlurSegment in measure 3.

As I said before, the crash happening when deleting two selected time signatures is a different bug. It is due to the fact that when selecting one time signature and deleting it, it actually deletes all the corresponding time signatures and therefore this is probably messing up with the original selection (two separate time signatures). See also the final comments of #29826: Deleting a key signature does not delete it from all staves of score. The solution could be the same as done in that case.