Skip to content

Commit

Permalink
Fix corruption issues on old files
Browse files Browse the repository at this point in the history
backport of musescore#20230, as far as it makes sense
  • Loading branch information
Jojo-Schmitz committed Nov 28, 2023
1 parent ba87541 commit fee7877
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 5 additions & 5 deletions libmscore/read114.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,8 +1105,8 @@ static bool readTextLineProperties114(XmlReader& e, TextLineBase* tl)
ls->setAutoplace(true);
tl->add(ls);
}
else if (tl->readProperties(e))
return true;
else if (!tl->readProperties(e))
return false;
return true;
}

Expand Down Expand Up @@ -1936,7 +1936,7 @@ static void readMeasure(Measure* m, int staffIdx, XmlReader& e)
j->setPlayRepeats(e.readBool());
else if (t == "subtype")
e.readInt();
else if (!j->TextBase::readProperties(e))
else if (!j->readProperties(e))
e.unknown();
}
m->add(j);
Expand All @@ -1948,12 +1948,12 @@ static void readMeasure(Measure* m, int staffIdx, XmlReader& e)
Marker::Type mt = Marker::Type::SEGNO;
while (e.readNextStartElement()) {
const QStringRef& t(e.name());
if (t == "subtype") {
if (t == "subtype" || t == "label") {
QString s(e.readElementText());
a->setLabel(s);
mt = a->markerType(s);
}
else if (!a->TextBase::readProperties(e))
else if (!a->readProperties(e))
e.unknown();
}
a->setMarkerType(mt);
Expand Down
10 changes: 2 additions & 8 deletions libmscore/read206.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,12 +1726,6 @@ bool readChordRestProperties206(XmlReader& e, ChordRest* ch)
else // not from old score: set duration fraction from duration type
ch->setTicks(ch->actualDurationType().fraction());
}
else {
if (ch->score()->mscVersion() <= 114) {
SigEvent event = ch->score()->sigmap()->timesig(e.tick());
ch->setTicks(event.timesig());
}
}
}
else if (tag == "BeamMode") {
QString val(e.readElementText());
Expand Down Expand Up @@ -2185,8 +2179,8 @@ static bool readTextLineProperties(XmlReader& e, TextLineBase* tl)
tl->setBeginHookType(e.readInt() == 0 ? HookType::HOOK_90 : HookType::HOOK_45);
else if (tag == "endHookType")
tl->setEndHookType(e.readInt() == 0 ? HookType::HOOK_90 : HookType::HOOK_45);
else if (tl->readProperties(e))
return true;
else if (!tl->readProperties(e))
return false;
return true;
}

Expand Down

0 comments on commit fee7877

Please sign in to comment.