The problem comes from full measure rests.
Here is a backtrace:
655 Q_ASSERT(_sd.numerator());
#0 Ms::Score::makeGap (this=0x20c3f618, segment=0x21248188, track=0, _sd=..., tuplet=0x0, keepChord=false)
at C:\Git_packages\MuseScore\libmscore\cmd.cpp:655
#1 0x0079f12d in Ms::Score::setNoteRest (this=0x20c3f618, segment=0x21248188, track=0, nval=..., sd=..., stemDirection=Ms::MScore::Direction::AUTO)
at C:\Git_packages\MuseScore\libmscore\cmd.cpp:529
#2 0x007b00ec in Ms::Score::addPitch (this=0x20c3f618, nval=..., addFlag=false)
at C:\Git_packages\MuseScore\libmscore\edit.cpp:1139
#3 0x00915ed3 in Ms::Cursor::addNote (this=0x2103abe0, pitch=60)
at C:\Git_packages\MuseScore\libmscore\cursor.cpp:161
#4 0x00865a68 in Ms::Cursor::qt_static_metacall (_o=0x2103abe0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x28bbf0)
at C:/Git_packages/MuseScore/build.debug/libmscore/moc_cursor.cpp:126
#5 0x00865b89 in Ms::Cursor::qt_metacall (this=0x2103abe0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x28bbf0)
at C:/Git_packages/MuseScore/build.debug/libmscore/moc_cursor.cpp:159
When the plugin hits a measure rest, the chord.durationType is 0, therefore the calculated new duration (inside the plugin at line 66 var dur = chord.durationType/15;) is 0 as well and this triggers the assert check since the numerator is 0 (fraction is 0/1).
If the measure rests in "My_First_Score" are substituted by whole (4/4) rests the crash disappears.
I changed the "project" field since the bug lies in how the plugin handles the halving of measure rests rather than how notes/rests are inserted in MuseScore.
As much as I figured it out, the reason for segfault in this case is that full measure rests are saved as rests with duration 0. That is why assertion on top of Score::makeGap() raises segmentation fault when you try to create one (0/2 = 0). For now, you can use modified version of plug-in (attached), but adding safeguard somewhere around Score::makeGap() or Score::setNoteRest() would probably be a good idea (suggestion to core developers).
Thanks for reviewing this issue.
The initial crash is fixed. I note, however, other "bad things" that lead easily to another crash and corruption (I say this for information, because I don't know which degree of stability is believed to have a plugin?)
I suppose however this kind of issues on "basic" operations should be avoided, at least.
Steps for reproduce:
1) "My First Score"
2) Input four quarter notes in the first measure
3) Plugins -> Halftime
4) Select these notes (image below) -> Hit "R" key (or copy-paste onto the half rest of the same first measure)
Result: crash
Notes:
- If you copy-paste these notes onto other empty easures in the score, the whole rests are deleted (ie corruption)
- Same origine I guess: Note input mode: select the half note value and input a note on the half rest, always first measure. Result: failure, and corruption.
Here are updated versions of both the halftime and the doubletime plugins where both the durationtype and the actual duration are set correctly.
The bug in #5 was coming from the fact that the duration was not set and therefore the chords and rests had a duration of 0/1 (this could be seen in the debugger in a Nightly build, for example).
I couldn't find a way to add a rest at a cursor position with a simple instruction such as "addRest" or similar, therefore I used a workaround.
I also found that when adding a chord or a rest via a plugin, the underlying chords/rests are not deleted. This can originate a corrupted state. I will report this in a different bug report.
Possible future refinement of these plugin could be the use of halved/doubled time signatures instead of 4/4 (I used 8/4 in the doubletime).
Hi!
I use scores for bells with not standart nuber of lines. See mscz file attached.
Both Halftime and Doubletime v.2.0.1 works when I use first and second staves but
1. crash when I try to use third stave (bells 3);
2. don't process double notes (see "bells 1");
3. add an extra note at the end;
4. do not save clefs and number of lines of stave.
(see plug_test.jpg)
Not yet, my cmake is currently going awol and stopped making c++0x instructions. I can verify half/doubletime once I've got that sorted (unless *someone* beats me to it)
One of the problem is that I was wrongly assuming the behavior of cursor.addNote.
Here are the versions which work up to two staves, without using the original instruments and key/time signatures. For those advanced cases probably the available plugin functions should be increased.
Sorry for not having posted this solution before: I had it since the beginning of January and I wanted to work on the number of instruments/tracks, but then I never found the time to complete it. This is just the "limited" version of the plugins.
For updating the segment I was using the trick which was already in use: rewind and then advance the cursor by the number of chords already written.
Thanks a lot for this new version, but it still crashes for me. Hopefully the attached debug will shed some light.
As mentioned elsewhere, whilst I'm clueless about MuseScore internals and plugins, I'm a software developer (have previously contributed to LilyPond) and am very keen to help fix things if given a few pointers on basic MuseScore debugging techniques.
The place to start to learn about development for MuseScore is the Development link in the menu at right of this page. See especially the Deverlopers Handbook, which contains lots of useful information on compiling, debugging, the data structures, etc.
Limitation
Great for single line part/s or when all the part/s are in the same voice.
I had difficulties when using a grand staff (piano) with several voices used for each hand. It would drop everything in the bass clef (left hand) and leave out anything in the second voice/part in either hand.
Doubletime v 2_0_2 works with one stave at a time in MuseScore 2.0.3, still it does a good work and saves a lot of headaches.
Halftime v 2_0_2 works fine with two staves at a time in MuseScore 2.0.3.
I don't know what to do with this patch. I open the file and all I see is a bunch of code. Is it intended to fix the problem of Doubletime causing Musescore to crash (which has happened to me)?
I am not an 'advanced user'. Please make it simple and, if necessary, step by step.
Thank you.
Sincerely,
Keith Lawrence
I took the file you cited (the alleged correction of Doubletime), saved it 'as' Doubletime. Same result, even worse. Entire system crashed, not only Musescore. Afterwards, Musescore was very slow in opening. Had to double-click on the icon several times.
Can we go back to square minus 1??
Assume I am a rank beginner (pretty close to the truth). Exactly what do I have to do to get Doubletime to work? Once the patch is installed does it have instructions on how to use it??
Thank you for your help.
Sincerely,]
Keith Lawrence
Hello! About one year ago, cadiz1 said that halftime_v2_0_2.qml (uploaded by ABL) seems more stable.
But the page https://musescore.org/en/project/halftime-musescore-2 still refers to halftime_v2_0_0.qml (which incidentally crashed my Musescore 2.2.1).
I think this page should be updated, since the average user is not supposed to parse the "issue tracker" to find the "good" version, is he?
Comments
The problem comes from full measure rests.
Here is a backtrace:
655 Q_ASSERT(_sd.numerator());
#0 Ms::Score::makeGap (this=0x20c3f618, segment=0x21248188, track=0, _sd=..., tuplet=0x0, keepChord=false)
at C:\Git_packages\MuseScore\libmscore\cmd.cpp:655
#1 0x0079f12d in Ms::Score::setNoteRest (this=0x20c3f618, segment=0x21248188, track=0, nval=..., sd=..., stemDirection=Ms::MScore::Direction::AUTO)
at C:\Git_packages\MuseScore\libmscore\cmd.cpp:529
#2 0x007b00ec in Ms::Score::addPitch (this=0x20c3f618, nval=..., addFlag=false)
at C:\Git_packages\MuseScore\libmscore\edit.cpp:1139
#3 0x00915ed3 in Ms::Cursor::addNote (this=0x2103abe0, pitch=60)
at C:\Git_packages\MuseScore\libmscore\cursor.cpp:161
#4 0x00865a68 in Ms::Cursor::qt_static_metacall (_o=0x2103abe0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x28bbf0)
at C:/Git_packages/MuseScore/build.debug/libmscore/moc_cursor.cpp:126
#5 0x00865b89 in Ms::Cursor::qt_metacall (this=0x2103abe0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x28bbf0)
at C:/Git_packages/MuseScore/build.debug/libmscore/moc_cursor.cpp:159
When the plugin hits a measure rest, the chord.durationType is 0, therefore the calculated new duration (inside the plugin at line 66
var dur = chord.durationType/15;
) is 0 as well and this triggers the assert check since the numerator is 0 (fraction is 0/1).If the measure rests in "My_First_Score" are substituted by whole (4/4) rests the crash disappears.
I changed the "project" field since the bug lies in how the plugin handles the halving of measure rests rather than how notes/rests are inserted in MuseScore.
Still a plugin should not be allowed to crash MuseSccore, so some protection seems needed?
As much as I figured it out, the reason for segfault in this case is that full measure rests are saved as rests with duration 0. That is why assertion on top of Score::makeGap() raises segmentation fault when you try to create one (0/2 = 0). For now, you can use modified version of plug-in (attached), but adding safeguard somewhere around Score::makeGap() or Score::setNoteRest() would probably be a good idea (suggestion to core developers).
Thanks for reviewing this issue.
The initial crash is fixed. I note, however, other "bad things" that lead easily to another crash and corruption (I say this for information, because I don't know which degree of stability is believed to have a plugin?)
I suppose however this kind of issues on "basic" operations should be avoided, at least.
Steps for reproduce:
1) "My First Score"
2) Input four quarter notes in the first measure
3) Plugins -> Halftime
4) Select these notes (image below) -> Hit "R" key (or copy-paste onto the half rest of the same first measure)
Result: crash
Notes:
- If you copy-paste these notes onto other empty easures in the score, the whole rests are deleted (ie corruption)
- Same origine I guess: Note input mode: select the half note value and input a note on the half rest, always first measure. Result: failure, and corruption.
Here are updated versions of both the halftime and the doubletime plugins where both the durationtype and the actual duration are set correctly.
The bug in #5 was coming from the fact that the duration was not set and therefore the chords and rests had a duration of 0/1 (this could be seen in the debugger in a Nightly build, for example).
I couldn't find a way to add a rest at a cursor position with a simple instruction such as "addRest" or similar, therefore I used a workaround.
I also found that when adding a chord or a rest via a plugin, the underlying chords/rests are not deleted. This can originate a corrupted state. I will report this in a different bug report.
Possible future refinement of these plugin could be the use of halved/doubled time signatures instead of 4/4 (I used 8/4 in the doubletime).
Hi!
I use scores for bells with not standart nuber of lines. See mscz file attached.
Both Halftime and Doubletime v.2.0.1 works when I use first and second staves but
1. crash when I try to use third stave (bells 3);
2. don't process double notes (see "bells 1");
3. add an extra note at the end;
4. do not save clefs and number of lines of stave.
(see plug_test.jpg)
as per https://musescore.org/en/node/94701#comment-418281 the crash still happens, even with the proposed fix from #7
Still crashes for me too 100% of the time with the proposed fix in doubletime 2.0.1.
I wouldn't be surprised if both plugins are affected by #100181: cursor.addNote doesn't update internal segment reference
If so our PR should fix it. Have you tried?
Not yet, my cmake is currently going awol and stopped making c++0x instructions. I can verify half/doubletime once I've got that sorted (unless *someone* beats me to it)
One of the problem is that I was wrongly assuming the behavior of cursor.addNote.
Here are the versions which work up to two staves, without using the original instruments and key/time signatures. For those advanced cases probably the available plugin functions should be increased.
Sorry for not having posted this solution before: I had it since the beginning of January and I wanted to work on the number of instruments/tracks, but then I never found the time to complete it. This is just the "limited" version of the plugins.
For updating the segment I was using the trick which was already in use: rewind and then advance the cursor by the number of chords already written.
Thanks a lot for this new version, but it still crashes for me. Hopefully the attached debug will shed some light.
As mentioned elsewhere, whilst I'm clueless about MuseScore internals and plugins, I'm a software developer (have previously contributed to LilyPond) and am very keen to help fix things if given a few pointers on basic MuseScore debugging techniques.
The place to start to learn about development for MuseScore is the Development link in the menu at right of this page. See especially the Deverlopers Handbook, which contains lots of useful information on compiling, debugging, the data structures, etc.
This worked without crashing v 2.0.3.
Limitation
Great for single line part/s or when all the part/s are in the same voice.
I had difficulties when using a grand staff (piano) with several voices used for each hand. It would drop everything in the bass clef (left hand) and leave out anything in the second voice/part in either hand.
It seems turion would need to accept and integrate ABL 's patch?
Doubletime v 2_0_2 works with one stave at a time in MuseScore 2.0.3, still it does a good work and saves a lot of headaches.
Halftime v 2_0_2 works fine with two staves at a time in MuseScore 2.0.3.
Came up again: #208636: Halftime plugin crashes Musescore
Nevertheless, the last version of this plugin (also DoubleTime) seems more stable: https://musescore.org/en/node/81641#comment-453686
In reply to #16 by adam.spiers
I don't know what to do with this patch. I open the file and all I see is a bunch of code. Is it intended to fix the problem of Doubletime causing Musescore to crash (which has happened to me)?
I am not an 'advanced user'. Please make it simple and, if necessary, step by step.
Thank you.
Sincerely,
Keith Lawrence
Just take that code and overwrite the existing plugin with it
In reply to Just take that code and… by Jojo-Schmitz
I took the file you cited (the alleged correction of Doubletime), saved it 'as' Doubletime. Same result, even worse. Entire system crashed, not only Musescore. Afterwards, Musescore was very slow in opening. Had to double-click on the icon several times.
Can we go back to square minus 1??
Assume I am a rank beginner (pretty close to the truth). Exactly what do I have to do to get Doubletime to work? Once the patch is installed does it have instructions on how to use it??
Thank you for your help.
Sincerely,]
Keith Lawrence
In reply to #21 by cadiz1
Hello! About one year ago, cadiz1 said that halftime_v2_0_2.qml (uploaded by ABL) seems more stable.
But the page https://musescore.org/en/project/halftime-musescore-2 still refers to halftime_v2_0_0.qml (which incidentally crashed my Musescore 2.2.1).
I think this page should be updated, since the average user is not supposed to parse the "issue tracker" to find the "good" version, is he?
Up to turion to do so.
Edit: I've attached the better working version to the plugin project now, same for double time
So let's put this issue to a rest...
Automatically closed -- issue fixed for 2 weeks with no activity.