Skip to content

Commit ccc8713

Browse files
wizofausJojo-Schmitz
authored andcommitted
Fix #324626: Linked dynamics not saving properly
Backport of musescore#9126
1 parent 2cf3779 commit ccc8713

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libmscore/dynamic.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,11 @@ void Dynamic::startEdit(EditData& ed)
320320
void Dynamic::endEdit(EditData& ed)
321321
{
322322
TextBase::endEdit(ed);
323-
if (xmlText() != QString::fromUtf8(dynList[int(_dynamicType)].text))
324-
_dynamicType = Type::OTHER;
323+
auto text = xmlText();
324+
auto it = std::find_if(std::begin(dynList), std::end(dynList), [text](const Ms::Dyn& d) { return text == QString::fromUtf8(d.text); });
325+
_dynamicType = it == std::end(dynList) ? Type::OTHER : static_cast<Type>(it - std::begin(dynList));
326+
for (auto* e : this->linkList())
327+
toDynamic(e)->_dynamicType = _dynamicType;
325328
}
326329

327330
//---------------------------------------------------------

0 commit comments

Comments
 (0)