Linked staff becomes unlinked (causing corruption) after delete of part

• Feb 26, 2016 - 18:31
S2 - Critical

Ubuntu 14.04, GIT commit: 3543170

I guess these steps caused *other* problems in 2.0.2, but the specific problem here is new with the recent changes to linked staves:

1) My First Score
2) generate parts (File / Parts, New All, OK)
3) add linked staff to staff in score (Edit / Instruments, select staff, add linked staff)
4) add note to staff in score and verify links work in both score and part, but part has only the original staff
5) delete the part (File / Parts, select part, Delete)
6) add a note to staff, see that it is not reflected in the formerly linked staff

I find that if I make changes to the measure where I added the first note (step 4), the change isn't linked, but otherwise things seem OK. If I enter a note into a enw measure, however, the full measure rest is deleted from the formerly linked staff, creating a corrupt score.

I guess that latter symptom tells me that the full measures rest thremselves are still linked even though the staves are not (and Edit / Instruments does appear to confirm the staves are no longer linked).
, and eventually corruption results


Actually, the object debuggers tell me the full measure rests have three links - one to self, one to the other staff in the score, and one still to the deleted part. Whereas the notes and rests in the measure I modified at step 4) are completely unlinked. So if it weren't for the full measures remaining linked - including to the deleted part - this would really just be a case of linked staves becoming unlinked. That's *almost* a feature :-).

A variation, without parts, but with the same symptoms.

1) "My First Score"
2) "I" -> Add two linked staves -> Ok
3) "I" -> Remove the first staff -> Ok
4) Enter notes in the second staff (treble clef)

Result: corruption (whole rests are deleted) in the "new" first staff, bass clef.

Status (old) fixed active

Better, but unfortunately, I see an issue with Undo:

With steps similar in comment #2:

1) "My First Score"
2) "I" -> Add two linked staves -> Ok
3) "I" -> Remove the first staff -> Ok
4) Enter a whole note in the first staff.
5) Undo

Result: corruption (the linked note is deleted AND its rest too) in the second linked staff

FWIW, this was true for 2.0.2 as well. Not sure if it is for the same reason (my fix for #50826: Add system text and undo causes crash in score with multiple parts) or not, but lasconic's PR does seem to fix this case, without breaking the #50826: Add system text and undo causes crash in score with multiple parts, the original steps here in this bug report, or the new ones given above. Whether it still fixes all the other bugs with linked staves I can't say.

This mentioned issue above #50826: Add system text and undo causes crash in score with multiple parts was fixed on March 18, 2015.
But the issue related in comment #5 occurs some days before, around the 14/15 March.

- For sum, I notice that this Nightly works: e96036e
14 mars.jpg
- Not this one: d0e6b72
15 mars.jpg
So, it might be related indeed to this commit:…

For fix: #50826: Add system text and undo causes crash in score with multiple parts
I am just undecided on one point.
As said, this issue was fixed (by this patch) on March 18: while I see this same day this commit:…
A bit mixed for the moment about the dates and the commits. Hope better understanding shortly. Or, it's the same fix with a different title of commit? A bit confused for now, sorry. It is late or rather very early in the day!

Sorry Lasconic, despite your efforts and great progress, not everything is solved :(
I can reproduce a crash easily again from scratch:

Steps (with 176a6d7 / Win7)

1) "My First Score"
2) "I" -> Add two linked staves -> Ok
3) Generate parts -> New all -> Ok
4) "I" -> Remove the staff 2 (bass clef) -> Ok
5) "N" -> enter a note
Result: crash

For the record, I can't reproduce the crash with same steps in comment #10 on March 17, 2016 with this nightly: 86c8f02
So, this one: 176a6d7 has broken something which had been fixed in the second half of February 2016 (this issue described above was present in the 2.0.2 already)
More precision soon.

I leave open this issue, because I get crashes (five for now, see below eg) with different operations from those described on comment # 10.
Mainly on Undo after adding / deleting linked staves.
Unfortunately, there is something imponderable or random (or perhaps related to the Auto Save?) Consequently, I am not able yet to reproduce on command.

And a file also, with a corrupted measure (I've never been able to reproduce this issue, but we can see the "configuration" of the score) : test piano.mscz
3ème crash.jpg

I managed to get a new crash.
Basically, I use the following steps:

1) My First Score
2) In Instruments dialog, I add a piano
3) I add a linked staff -> ok
4) "I" again: I delete the center staff (bass clef)
5) I enter some quarter notes into 4-8 measures, randomly in the differents staves.
6) Undo, partial or total
7) If nothing happens, I repeat steps #3 (add a linked staff) et #4 (delete a staff), and continue a new time the steps #5 and #6
Most of the time, it works well. And sometimes (very few), I get a crash or a corrupted measure on Undo

Unfortunately, it's still inconsistently, almost unpredictable, and always after a certain time (a time certain) following many entry operations of notes and cancellations. Never quickly. This is why it reminded me to the auto save (but perhaps misconception on my part)
nouveau crash.jpg

I also managed to get a new corrupt score. This one: My_First_Score1.mscz

This may be a new fact, that might be interesting (?), to advance this issue.

When I reload the file, and I am invited to restore the previous session, to my surprise, it is the "Selection" palette which appears (with all the unchecked radio buttons). While, as usual, I always work with the displayed main palette

This happened two or three times in the tests on this issue. And, from memory, I do not remember any similar cases.
restaurer la session.jpg
score corrompu.jpg

And when, after the "event" described above, I open the 2.0.2, I notice that the main palette is empty!
Reverts well by switching to Advanced or Basic workspace. Or, by deleting my customized workspace and re-creating a new one.

I commited several more changes on master about this issue. I believe it's fixed in master. I would love more tests to see if we include it in 2.0.3 or not.

I can not reproduce for now the issues with steps described in initial message, and in comments #2, #5 and #15.
I continued further other tests (add, delete linked staves/ add, delete parts/ undo, redo): for now, all tests have withstood to this shock treatment, violent, rather!

I'm not saying that I have not missed something, but it's definitely better (if not totally solved?), and it would be a shame to not include in the 2.0.3. But only the opinion of a tester.
Other tests today I hope.

I can't say I've tested as thoroughly as cadiz1, and we'll need to test more once in 2.0.3 to make sure the code isn't depending on something else that is only in the master, but from what I can see, we should go ahead.