Musescore crashes

• May 8, 2011 - 15:01

Dear Musescore Developers,

I have a problem with a plugin I'm currently writing. It is supposed to repitch notes of a voice with pitches of another voice and I described it here already. The reason for opening a new thread is that during the development I encountered several crashes of Musescore. I'd like to know whether maybe something with the scripting framework is going wrong or if I'm writing incredibly crappy code.

Right now I came to a point where it actually works as I have borrowed code from several other plugins.
But on the second note Musescore violently crashes. Using the script debugger shows that (this time, it has been on other lines for various times and for me not understandable reasons) it is the line where the note is added to the chord. Strangely it works once. The core of it looks like that:

while (!source_cursor.eos())
{
if (source_cursor.isChord())
{
addNote(target_cursor, // CRASH on second note
source_cursor.chord().topNote().pitch,
target_cursor.chord().tickLen);
}
target_cursor.next();
source_cursor.next();

}
[...]
// taken from "Create Score" plugin,
// not touched, should work
function addNote(cursor, pitch, duration)
{
var chord = new Chord();
chord.tickLen = duration;
var note = new Note();
note.pitch = pitch;

chord.addNote(note);
cursor.add(chord);
cursor.next();
};

The error I'm getting looks like that:

Process: mscore [1456]
Path: /Applications/MuseScore.app/Contents/MacOS/mscore
Identifier: net.sourceforge.mscore
Version: 1.0 (1.0)
Code Type: X86 (Native)
Parent Process: launchd [128]

Date/Time: 2011-05-08 15:52:50.557 +0200
OS Version: Mac OS X 10.6.7 (10J869)
Report Version: 6

Interval Since Last Report: 554888 sec
Crashes Since Last Report: 55
Per-App Interval Since Last Report: 72450 sec
Per-App Crashes Since Last Report: 25
Anonymous UUID: 70A8B140-00BF-41E8-A3DA-88B89626BE55

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 net.sourceforge.mscore 0x003088f9 prototype_Cursor_call(QScriptContext*, QScriptEngine*) + 2553
1 QtScript 0x02340523 QScriptable::QScriptable() + 3075
2 QtScript 0x0224d215 operator delete(void*, void*) + 250101

One more thing I really don't understand is the following! If I run the "Note names" plug in, everything is ok. If I activate the script debugger, it doesn't work! Musescore then complains that certain objects are not created properly (cursor, notes, or text in my example)!

I'm a little desperate and demotivated so please tell me whether this is a general error in the Musescore scripting environment (looks a little like that) or if my code is crappy. I've attached a full version as well..

Thank you very much,
Carlx

Attachment Size
Bildschirmfoto 2011-05-08 um 14.53.55.png 24.99 KB
repitch.zip 3.98 KB

Do you still have an unanswered question? Please log in first to post your question.