Skip to content

Commit

Permalink
Fix crash on delete linked staff and delete bend
Browse files Browse the repository at this point in the history
Backport of musescore#25496, plus fixing clazy warnings
  • Loading branch information
mike-spa authored and Jojo-Schmitz committed Nov 20, 2024
1 parent 2021894 commit 981e55e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ void Note::draw(QPainter* painter) const
if (i < in->minPitchP() || i > in->maxPitchP())
painter->setPen(selected() ? Qt::darkRed : Qt::red);
else if (i < in->minPitchA() || i > in->maxPitchA())
painter->setPen(selected() ? QColor("#565600") : Qt::darkYellow);
painter->setPen(selected() ? QColor(0x565600) : Qt::darkYellow);
}
// draw blank notehead to avoid staff and ledger lines
if (_cachedSymNull != SymId::noSym) {
Expand Down Expand Up @@ -1784,7 +1784,7 @@ Element* Note::drop(EditData& data)

if (group != _headGroup) {
if (links()) {
for (ScoreElement* se : *links()) {
for (ScoreElement*& se : *links()) {
se->undoChangeProperty(Pid::HEAD_GROUP, int(group));
Note* note = toNote(se);
if (note->staff() && note->staff()->isTabStaff(ch->tick()) && group == NoteHead::Group::HEAD_CROSS)
Expand Down Expand Up @@ -2834,7 +2834,7 @@ void Note::setNval(const NoteVal& nval, Fraction tick)
void Note::localSpatiumChanged(qreal oldValue, qreal newValue)
{
Element::localSpatiumChanged(oldValue, newValue);
for (Element* e : dots())
for (Element* e : qAsConst(dots()))
e->localSpatiumChanged(oldValue, newValue);
for (Element* e : el())
e->localSpatiumChanged(oldValue, newValue);
Expand Down Expand Up @@ -3161,7 +3161,7 @@ QString Note::screenReaderInfo() const
else
pitchName = _headGroup == NoteHead::Group::HEAD_NORMAL
? tpcUserName(true)
: QObject::tr("%1 head %2").arg(subtypeName()).arg(tpcUserName(true));
: QObject::tr("%1 head %2").arg(subtypeName(), tpcUserName(true));
return QString("%1 %2 %3%4").arg(noteTypeUserName(), pitchName, duration, (chord()->isGrace() ? "" : QString("; %1").arg(voice)));
}

Expand Down Expand Up @@ -3618,6 +3618,8 @@ void Note::undoUnlink()
Element::undoUnlink();
for (Element* e : _el)
e->undoUnlink();
for (Spanner*& s : _spannerFor)
s->undoUnlink();
}

}

0 comments on commit 981e55e

Please sign in to comment.