My plugin ceashes MuseScore

• Apr 27, 2015 - 16:14

Now I'm coding the shakuhachi notation plugin for MuseScore v2.
I run Shakuhachi notation plugin, and "UNDO", and run the plugin again.
Then, MuseScore has clashed.
MacOSX 10.9.5 (iMac 2014 and iMac 2011)
I cannot identify the bad code.
Plese help me.
The crash does not reproduce in MacOSX 10.8.5 and Windows 7.

----- Clash Message 1(part) -----

Process: mscore [20245]
Path: /Applications/MuseScore 2.app/Contents/MacOS/mscore
Identifier: org.musescore.MuseScore
Version: 2.0 (2.0.0)
Code Type: X86-64 (Native)
Parent Process: launchd [153]
Responsible: mscore [20245]
User ID: 501

Date/Time: 2015-04-27 17:48:44.814 +0900
OS Version: Mac OS X 10.9.5 (13F1077)
Report Version: 11

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000100000000

VM Regions Near 0x100000000:
-->
__TEXT 000000010589c000-00000001063d4000 [ 11.2M] r-x/rwx SM=COW /Applications/MuseScore 2.app/Contents/MacOS/mscore

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_c.dylib 0x00007fff89145732 strlen + 18
1 org.qt-project.QtCore 0x0000000106bfa544 QString::vsprintf(char const*, __va_list_tag*) + 3540
2 org.qt-project.QtCore 0x0000000106bfa544 QString::vsprintf(char const*, __va_list_tag*) + 3540
3 org.qt-project.QtCore 0x0000000106b4dc85 0x106b2b000 + 142469
4 org.qt-project.QtCore 0x0000000106b4dbca QMessageLogger::debug(char const*, ...) const + 170
5 org.musescore.MuseScore 0x0000000106055282 Ms::AddElement::cleanup(bool) + 98
6 org.musescore.MuseScore 0x000000010604d92d Ms::UndoCommand::cleanup(bool) + 317
7 org.musescore.MuseScore 0x000000010604e134 Ms::UndoStack::endMacro(bool) + 564
8 org.musescore.MuseScore 0x0000000105e9060e Ms::Score::endCmd(bool) + 638
9 org.musescore.MuseScore 0x0000000105e26ae0 Ms::Score::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 320
10 org.musescore.MuseScore 0x0000000105e26dd9 Ms::Score::qt_metacall(QMetaObject::Call, int, void**) + 89
11 org.qt-project.QtQml 0x000000010842da4a 0x1082c5000 + 1477194
12 org.qt-project.QtQml 0x000000010842d359 0x1082c5000 + 1475417
13 org.qt-project.QtQml 0x000000010842ce68 QV4::QObjectMethod::callInternal(QV4::CallData*) + 3128
14 org.qt-project.QtQml 0x0000000108438aaf QV4::Runtime::callProperty(QV4::ExecutionContext*, QV4::String*, QV4::CallData*) + 671

----- Clash Message 2(part) -----

Process: mscore [11812]
Path: /Applications/MuseScore 2.app/Contents/MacOS/mscore
Identifier: org.musescore.MuseScore
Version: 2.0 (2.0.0)
Code Type: X86-64 (Native)
Parent Process: launchd [183]
Responsible: mscore [11812]
User ID: 501

Date/Time: 2015-04-27 22:27:29.606 +0900
OS Version: Mac OS X 10.9.5 (13F1077)
Report Version: 11

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.musescore.MuseScore 0x000000010684e247 Ms::Element::name() const + 7
1 org.musescore.MuseScore 0x00000001069f3268 Ms::AddElement::cleanup(bool) + 72
2 org.musescore.MuseScore 0x00000001069eb92d Ms::UndoCommand::cleanup(bool) + 317
3 org.musescore.MuseScore 0x00000001069ec134 Ms::UndoStack::endMacro(bool) + 564
4 org.musescore.MuseScore 0x000000010682e60e Ms::Score::endCmd(bool) + 638
5 org.musescore.MuseScore 0x00000001067c4ae0 Ms::Score::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 320
6 org.musescore.MuseScore 0x00000001067c4dd9 Ms::Score::qt_metacall(QMetaObject::Call, int, void**) + 89
7 org.qt-project.QtQml 0x0000000108dcfa4a 0x108c67000 + 1477194
8 org.qt-project.QtQml 0x0000000108dcf359 0x108c67000 + 1475417
9 org.qt-project.QtQml 0x0000000108dcee68 QV4::QObjectMethod::callInternal(QV4::CallData*) + 3128
10 org.qt-project.QtQml 0x0000000108ddaaaf QV4::Runtime::callProperty(QV4::ExecutionContext*, QV4::String*, QV4::CallData*) + 671
11 ??? 0x000000010c4f11a3 0 + 4501475747
12 org.qt-project.QtQml 0x0000000108d8a190 0x108c67000 + 1192336
13 org.qt-project.QtQml 0x0000000108dda805 QV4::Runtime::callActivationProperty(QV4::ExecutionContext*, QV4::String*, QV4::CallData*) + 725

Attachment Size
Shakuhachi_Notation_test01.qml 11.61 KB

Comments

I tried your code on OS X Yosemite 10.10.3 and it didn't crash, even after multiple runs + undos. Must be a bug related to 10.9.5.

In reply to by jensm

Thank you.

I updated my iMac from 10.9.5(Merverics)) to 10.10.3(Yosemite), but the situation is completely the same.

Start "Shakuhachi_Notation_test01.qml" from plugins menu or plugin creator.
Run the plugin, displayed shakuhachi notations under the notes.
Undo (command+Z), (deleted shakuhachi notations)
Re-run plugin and push "OK".
Then clash.
This phenomenon has been reproduced with a probability of 100%.

Instead of "Undo", Right click -> Select -> All Similar Elements -> DELETE has no problem.

In reply to by jensm

The problem has solved, but I don't understand the reason.

Line 380 was
// text = newElement(Element.STAFF_TEXT);
When I uncommented this line,
text = newElement(Element.STAFF_TEXT);
the clash has no longer happen.

Thank you.

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