Skip to content

Commit

Permalink
Merge pull request #18799 from Eism/tied_notes_crash_fix_4.1.1
Browse files Browse the repository at this point in the history
fixed #18796: Crash after adding thirds on tied notes
  • Loading branch information
Eism committed Jul 25, 2023
2 parents 691f32f + d761025 commit 29aee24
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/engraving/libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,14 @@ void Score::addInterval(int val, const std::vector<Note*>& nl)
{
// Prepare note selection in case there are not selected tied notes and sort them
std::vector<Note*> tmpnl;
bool shouldSelectFirstNote = nl.size() == 1 && nl[0]->tieFor();
for (auto n : nl) {
std::vector<Note*> _nl = nl;
bool shouldSelectFirstNote = _nl.size() == 1 && _nl[0]->tieFor();

std::sort(_nl.begin(), _nl.end(), [](const Note* a, const Note* b) -> bool {
return a->tick() < b->tick();
});

for (auto n : _nl) {
if (std::find(tmpnl.begin(), tmpnl.end(), n) != tmpnl.end()) {
continue;
}
Expand Down Expand Up @@ -755,6 +761,7 @@ void Score::addInterval(int val, const std::vector<Note*>& nl)
tie->setTick2(note->tick());
note->setTieBack(tie);
undoAddElement(tie);
prevTied = nullptr;
}
if (on->tieFor()) {
Tie* tie = Factory::createTie(this->dummy());
Expand Down

0 comments on commit 29aee24

Please sign in to comment.