Skip to content

Commit

Permalink
fix #49801 Crash deleting stem slash on grace note
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Mar 6, 2015
1 parent 2b9daf6 commit 97e9f7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 2 additions & 5 deletions libmscore/chord.cpp
Expand Up @@ -237,9 +237,8 @@ Chord::Chord(const Chord& c, bool link)
add(new Stem(*(c._stem)));
if (c._hook)
add(new Hook(*(c._hook)));
if (c._stemSlash) {
if (c._stemSlash)
add(new StemSlash(*(c._stemSlash)));
}
if (c._arpeggio) {
Arpeggio* a = new Arpeggio(*(c._arpeggio));
add(a);
Expand Down Expand Up @@ -548,7 +547,6 @@ void Chord::remove(Element* e)
Q_ASSERT(_stemSlash);
if (_stemSlash->selected() && score())
score()->deselect(_stemSlash);
delete _stemSlash;
_stemSlash = 0;
break;
case Element::Type::CHORDLINE:
Expand Down Expand Up @@ -1238,9 +1236,8 @@ void Chord::layoutStem1()
if (_stem)
score()->undoRemoveElement(_stem);
if (_stemSlash)
remove(_stemSlash);
score()->undoRemoveElement(_stemSlash);
}

}

//---------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions libmscore/edit.cpp
Expand Up @@ -1738,6 +1738,11 @@ void Score::deleteItem(Element* el)
case Element::Type::GLISSANDO_SEGMENT:
el = static_cast<SpannerSegment*>(el)->spanner();

case Element::Type::STEM_SLASH: // cannot delete this elements
case Element::Type::HOOK:
qDebug("cannot remove %s\n", el->name());
break;

default:
undoRemoveElement(el);
break;
Expand Down

0 comments on commit 97e9f7a

Please sign in to comment.