CRASH on close score after deleting all segment of a spanner
OP: https://musescore.org/en/node/105941
Reproduction steps:
- open slures.mscz
- right click slur
- select all similar elements
- delete
- close score (don't need to bother saving)
Result: SIGSEGV with call stack:
1 ?? 2 Ms::Element::name element.cpp 245 0x11c24d5 3 Ms::RemoveElement::cleanup undo.cpp 1655 0x1363ca6 4 Ms::UndoCommand::cleanup undo.cpp 131 0x135c3f6 5 Ms::UndoStack::~UndoStack undo.cpp 198 0x135c63e 6 Ms::Score::~Score score.cpp 433 0x127d7d1 7 Ms::Score::~Score score.cpp 437 0x127da74 8 Ms::MuseScore::removeTab musescore.cpp 2066 0xbf1534 9 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 798 0x1031238 10 QMetaObject::activate qobject.cpp 3730 0x7fffef483870 11 Ms::ScoreTab::tabCloseRequested moc_scoretab.cpp 172 0x10384ae 12 Ms::ScoreTab::qt_static_metacall moc_scoretab.cpp 94 0x10381c1 13 QMetaObject::activate qobject.cpp 3730 0x7fffef483870 14 QMetaObject::activate qobject.cpp 3595 0x7fffef484147 15 QTabBar::tabCloseRequested moc_qtabbar.cpp 339 0x7ffff031c781 16 QMetaObject::activate qobject.cpp 3730 0x7fffef483870 17 QMetaObject::activate qobject.cpp 3595 0x7fffef484147 18 QAbstractButton::clicked moc_qabstractbutton.cpp 307 0x7ffff05072f2 19 QAbstractButtonPrivate::emitClicked qabstractbutton.cpp 533 0x7ffff0275484 20 QAbstractButtonPrivate::click qabstractbutton.cpp 526 0x7ffff0276937 ...
Stopped at this line:
const char* Element::name() const { return name(type());
Happens on Win 8.1 x86-64 2.0.3 and Arch Linux x86-64 latest master. And Jojo says on Win 7. And original reporter say win10 32bit.
Comments
that Element::name() method is called from a qDebug() in RemoveElement::cleanup(), meaning if won't be in the RELEASEd version, but that crashes too.
So I commented that line out, and sure enough it now crashes in the next line, `delete element;`
Is this issue related by any chance to: Closing a file after multiple delete of ties in file imported from MIDI causes crash ?
Indeed likely related
I've created a minimal test case which will produce the crash, consisting of two measures with line break inbetween, and either a Tie or a Slur in between...here's steps:
tie-across-linebreak.mscx
Result: CRASH.
I believe the source of the error is the extra little carry over slur bit that is generated before the next system when there is a line break between a slur/tie. It is possible that the select all is selecting both of these elements, and deleting them both, and this double-delete is probably somehow related to the crash on close. Solution might lie in only deleting the real slur/tie, and letting the generated carry-over bit be naturally un-generated on next layout.
I suspect your analysis is correct. There is a Slur (which is the whole thing) and the SlurSegment (which are the two separate parts of the slur). When you select a slur, there is very often confusion between which of the two should really be selected, and which should actually be operated on internally. We've been bitten by many bugs having to do with this over the years.
Thanks. I've also checked the same thing with Hairpins & glissando, and they both crash. So I believe this bug generalizes to possibly all Spanner elements which cross a linebreak.
Well I'm starting to make my test case...of course that test case is not done yet (I need to add the deletes):
https://github.com/ericfont/MuseScore/commit/c583f99c5e77413821ee7cd1c5…
I'm just making a note that I'm claiming this bug, and just seeing if anyone can think of other types of things to test (I'm testing slur, tie, gliss, hairpin...but just wondering if there is some other class of objects I should test).
Anything derived from Spanner. Basically, everything on the Lines palette (including pedal, ottava, volta, etc).
Eric, any updates?
I never got back to this.
Are you still working on it?
Fixed in branch 2.1, commit c114512358
fix #105951: CRASH on close score after deleting all segment of a spanner
as far as I can see fix is needed for master too
Yes, but it needs merging, and testing, and so patience.
Fixed in branch master, commit 8381b3edc3
fix #105951: CRASH on close score after deleting all segment of a spanner
Please translate 'patience' ;-)
Automatically closed -- issue fixed for 2 weeks with no activity.