Crash on use of repitch mode

• Jun 19, 2014 - 16:08
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Ubuntu Studio 14.04, GIT commit: 2c43586

1) new score
2) enter some notes
3) exit note entry mode
4) click first note
5) note entry mode, repitch mode
6) type a note

Result: crash

The crash happens because in Note::transposeTpc, there is a call to staff()->part()->instr()->transpose(), but actually staff() is returning 0. Apparently repitch mode, the note is not assigned a track until later.

My first thought was to fix the crash by testing staff() first, and I see this is done some of the other places in note.cpp where staff()->part() gets called. There are a few of other places where no such test is made, and I wonder if they are crashes waiting to happen.

However, while that fixes the crash, the real problem is that the note doesn't have a staff assignment yet. With that fix in place, there is no crash, but the note won't transpose properly if it's a transposing instrument.

So I think we really need to assign the staff earlier in the process. I'm going to look at this and also #24482: Ties broken when changing pitches in repitch mode, which for all I know will turn out to have the same cause.


Comments