Crash when setting ambitus' top or bottom note to 'undefined'
To reproduce this crash:
1.: In 2.0 nightly, add an Ambitus from the lines palette. Its only drop targets are clefs.
2.: Select it and press f8 to open the inspector
3.: Set either the top or bottom note to undefined.
Terminal output:
user:~/MuseScore/build.release/mscore$ ./mscore
Marker::read type 0
SUB: chord does not contain degree 913(0):
tpc -1 >= 35
Abgebrochen (Speicherabzug geschrieben)
(this means: terminated, core dumped)
Please tell me if I should obtain more information, e.g. the core dump(don't know where it is).
Personally, I think it shouldn't be possible to set that note to undefined, so simply removing the reference in the list would fix this.
Comments
I was able to fix this myself. I don't know whether this is the way to do it, but it seems to be clean. This is my first code contribution to any software project, so please tell me if I do something wrong or if there is a better way to do this.
Line 56 in mscore/inspector/inspectorAmbitus.cpp:
static const int tpcs[] = {
TPC_C_BB, TPC_C_B, TPC_C, TPC_C_S, TPC_C_SS,
TPC_D_BB, TPC_D_B, TPC_D, TPC_D_S, TPC_D_SS,
TPC_E_BB, TPC_E_B, TPC_E, TPC_E_S, TPC_E_SS,
TPC_F_BB, TPC_F_B, TPC_F, TPC_F_S, TPC_F_SS,
TPC_G_BB, TPC_G_B, TPC_G, TPC_G_S, TPC_G_SS,
TPC_A_BB, TPC_A_B, TPC_A, TPC_A_S, TPC_A_SS,
TPC_B_BB, TPC_B_B, TPC_B, TPC_B_S, TPC_B_SS,
};
I removed the first entry of the ... array? struct? i don't know...
Additionally, the file mscore/inspector/inspector_ambitus.ui needs to be changed.
The lines removed:
<item>
<property name="text">
<string><undefined></string>
</property>
</item>
This appears twice, one for top and one for bottom note.
Sorry for going into length here. But I have never contributed before and obviously have not much experience in this. I would be super grateful if you could walk me through the forking and commiting and pull requesting, alternatively you can of course just change the files yourself.
Greetings, Rafael
Hi, you can read about the contribution workflow here http://musescore.org/en/developers-handbook/git-workflow
Regarding the fix, I'm not sure I understand it but I would not remove the first element of the array which seem to be "complete". It contains all the possible TPC for a note. See http://musescore.org/en/plugin-development/tonal-pitch-class-enum
I have edited my post to also show the code snippet in the .ui file.(it wasn't showing because it looked like html)
I understand that the array contains all possible pitches. Is 'undefined' a possible tonal pitch class for a note? It doesn't seem to be, because it crashed musescore. Now the array contains 35 which is the correct length; there is no other possibility.
I have gone through all the steps and made a pull request. Thank you, lasconic, for pointing me to the guide!
PR is at: https://github.com/musescore/MuseScore/pull/777
See PR#779
merged f08d84634a
Automatically closed -- issue fixed for 2 weeks with no activity.