Skip to content

Commit

Permalink
Merge pull request #5354 from MarcSabatella/295106-navigation-crash
Browse files Browse the repository at this point in the history
fix #295106: crash on next element
  • Loading branch information
anatoly-os committed Oct 1, 2019
2 parents fee7af7 + 6c51400 commit 55ca960
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions libmscore/bsymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void BSymbol::add(Element* e)
{
if (e->isSymbol() || e->isImage()) {
e->setParent(this);
e->setTrack(track());
_leafs.append(e);
toBSymbol(e)->setZ(z() - 1); // draw on top of parent
}
Expand Down
6 changes: 6 additions & 0 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4479,6 +4479,12 @@ void Score::undoAddElement(Element* element)
}
}
}
else if (ne->isFretDiagram()) {
// update track of child harmony
FretDiagram* fd = toFretDiagram(ne);
if (fd->harmony())
fd->harmony()->setTrack(ntrack);
}

undo(new AddElement(ne));
// transpose harmony if necessary
Expand Down
1 change: 1 addition & 0 deletions libmscore/navigate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ Element* Score::nextElement()
while (e) {
switch (e->type()) {
case ElementType::NOTE:
case ElementType::REST:
case ElementType::CHORD: {
Element* next = e->nextElement();
if (next)
Expand Down
8 changes: 6 additions & 2 deletions libmscore/segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,9 @@ Element* Segment::nextElement(int activeStaff)
case ElementType::STAFF_STATE:
case ElementType::INSTRUMENT_CHANGE:
case ElementType::STICKING: {
Element* next = nextAnnotation(e);
Element* next = nullptr;
if (e->parent() == this)
next = nextAnnotation(e);
if (next)
return next;
else {
Expand Down Expand Up @@ -1624,7 +1626,9 @@ Element* Segment::prevElement(int activeStaff)
case ElementType::STAFF_STATE:
case ElementType::INSTRUMENT_CHANGE:
case ElementType::STICKING: {
Element* prev = prevAnnotation(e);
Element* prev = nullptr;
if (e->parent() == this)
prev = prevAnnotation(e);
if (prev)
return prev;
if (notChordRestType(this)) {
Expand Down

0 comments on commit 55ca960

Please sign in to comment.