Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #18796: Crash after adding thirds on tied notes #18799

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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