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

Fix adding tuplets to linked staff corrupts score file #18879 #18887

Conversation

mike-spa
Copy link
Contributor

@mike-spa mike-spa commented Aug 2, 2023

Resolves: #18879

@mike-spa mike-spa force-pushed the fixAddingTupletsToLinkedStaffCorruptsScoreFile#18879 branch from abebb4c to 6c3ee6f Compare August 16, 2023 09:11
@mike-spa mike-spa force-pushed the fixAddingTupletsToLinkedStaffCorruptsScoreFile#18879 branch from 6c3ee6f to 30ba40e Compare September 19, 2023 09:35
Comment on lines 2124 to 2131
for (EngravingObject* linked : *links()) {
EngravingItem* linkedItem = toEngravingItem(linked);
if (linkedItem->staff() == linkedStaffInScore) {
return linkedItem;
}
}

return nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be nice to replace this with findLinkedInStaff(linkedStaffInScore), to reduce repetition and to clarify the intent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that's what I meant to do, I must have forgotten. Done now, thanks

The function did not take into account that an item can have multiple links within the same score (e.g. linked TABs).

Now EngravingItem::findLinkedInScore(Score*) returns (if exists) the item linked in the required score AND in a staff with same id.

Additionally, EngravingItem::findLinkedInStaff(Staff*) returns if (exists) the linked item in the required staff.
@mike-spa mike-spa force-pushed the fixAddingTupletsToLinkedStaffCorruptsScoreFile#18879 branch from 30ba40e to 4e6d03b Compare September 19, 2023 15:23
@cbjeukendrup cbjeukendrup merged commit 1d3036d into musescore:master Sep 20, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding Tuplets To Linked Staff Corrupts Score File
3 participants