Crash on tie between notes on different staves with cross staff notation

• Sep 14, 2015 - 01:43
S2 - Critical

Steps to Reproduce:
1. Open the 2 score.
2. Copy the treble portion of measures 19 and 20 in Ill_Fly_-Full_Score to measure 19 in Cleaned Up.
3. Add a tie to the final e in measure 18 so that it connects with measure 19.

GIT commit: 9878ef4


- Reproduced the problem on the latest stable & nightly builds for Windows 7
- ThinkPad T440p

Attachment Size
Cleaned Up I'll_Fly.mscz 32.88 KB
Ill_Fly_-_Full_Score.mscz 43.34 KB


I am able to reproduce the crash, but there is an important aspect to the instructions that is missing. Apparently the staves are backwards in the source score from what they appear to be. From measures 17 to 20, all the notes that appear to be on the top staff actually on the bottom staff but moved to the bottom via cross staff notation (Ctrl+Shift+Down) and vice versa. So when you attempt to copy and paste the top staff notes, you are actually pasting the notes that *appear* to be in the bottom staff. There is nothing for the notes in the top staff at the end of measure 18 to tie to - measure 19 contains only notes that appear in the bottom staff.

if on the other hand I try to copy the *bottom* staff from the source score to the destination, thse will appear to be in the top staff, and it will *look* like there is something in measure 19 to tie the note in measure 18 to, but if you try it, you do indeed get a crash.

It turns out this problem can be reproduced easily from scratch as well, not copy and paste involved:

1) new score for piano, 4/4
2) measure 1, top staff, note input
3) enter a whole note middle C
4) measure 2, *bottom* staff, note input
5) enter a whole note middle C
6) press Ctrl+Shift up to move to top staff
7) leave note input mode
8) click first note
9) press "+"

Result: crash. We are finding the note to tie to, but doing the staff index calculations wrong somehow. The crash happens here:…

We are finding staffIdx is 0, sm is -1, so we are trying to find call score->staff(-1).

Looks like I added that code with this commit:…

Here is the associated PR:

Looks liek I removed some code I didn't understand that appeared to be duplicate of spome other code, maybe that was part of the problem, maybe not. Anyhow, I will look into this further.