Skip to content

Commit

Permalink
Fix #330595: Crash on selecting entire score after XML import
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Apr 16, 2022
1 parent 4bd3a27 commit 0471cd6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/engraving/libmscore/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void Selection::appendChord(Chord* chord)
if (note->accidental()) {
_el.push_back(note->accidental());
}
foreach (EngravingItem* el, note->el()) {
for (EngravingItem* el : note->el()) {
appendFiltered(el);
}
for (NoteDot* dot : note->dots()) {
Expand All @@ -519,7 +519,7 @@ void Selection::appendChord(Chord* chord)
if (note->tieFor()->endElement()->isNote()) {
Note* endNote = toNote(note->tieFor()->endElement());
Segment* s = endNote->chord()->segment();
if (s->tick() < tickEnd()) {
if (!s || s->tick() < tickEnd()) {
_el.push_back(note->tieFor());
}
}
Expand All @@ -528,7 +528,7 @@ void Selection::appendChord(Chord* chord)
if (sp->endElement()->isNote()) {
Note* endNote = toNote(sp->endElement());
Segment* s = endNote->chord()->segment();
if (s->tick() < tickEnd()) {
if (!s || s->tick() < tickEnd()) {
_el.push_back(sp);
}
}
Expand Down Expand Up @@ -726,7 +726,7 @@ void Selection::dump()
case SelState::LIST: qDebug("LIST");
break;
}
foreach (const EngravingItem* e, _el) {
for (const EngravingItem* e : _el) {
qDebug(" %p %s", e, e->typeName());
}
}
Expand Down Expand Up @@ -903,7 +903,7 @@ QByteArray Selection::symbolListMimeData() const
std::multimap<qint64, MapData> map;

// scan selection element list, inserting relevant elements in a tick-sorted map
foreach (EngravingItem* e, _el) {
for (EngravingItem* e : _el) {
switch (e->type()) {
/* All these element types are ignored:
Expand Down Expand Up @@ -1077,7 +1077,7 @@ QByteArray Selection::symbolListMimeData() const
if (seg->isChordRestType()) {
// if no ChordRest in right track, look in anotations
if (seg->element(currTrack) == nullptr) {
foreach (EngravingItem* el, seg->annotations()) {
for (EngravingItem* el : seg->annotations()) {
// do annotations include our element?
if (el == iter->second.e) {
done = true;
Expand Down Expand Up @@ -1121,7 +1121,7 @@ std::vector<Note*> Selection::noteList(int selTrack) const
std::vector<Note*> nl;

if (_state == SelState::LIST) {
foreach (EngravingItem* e, _el) {
for (EngravingItem* e : _el) {
if (e->isNote()) {
nl.push_back(toNote(e));
}
Expand Down

0 comments on commit 0471cd6

Please sign in to comment.