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 #19480 last tied note accidentals #19482

Merged
merged 2 commits into from Oct 2, 2023

Conversation

sammik
Copy link
Contributor

@sammik sammik commented Sep 21, 2023

Resolves: #19480

Caused by 43df579

Last tied note was excluded by for loop condition

I reverted that change and added other safety check(s)

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@sammik
Copy link
Contributor Author

sammik commented Sep 21, 2023

@mike-spa

Comment on lines +2035 to 2041
Note* nn = n;
while (nn && nn->tieFor()) {
nn = nn->tieFor()->endNote();
if (nn) {
score->undo(new ChangePitch(nn, pitch, tpc1, tpc2));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not:

Suggested change
Note* nn = n;
while (nn && nn->tieFor()) {
nn = nn->tieFor()->endNote();
if (nn) {
score->undo(new ChangePitch(nn, pitch, tpc1, tpc2));
}
}
for (Note* nn = n; nn; nn = nn->tieFor() ? nn->tieFor()->endNote() : nullptr) {
score->undo(new ChangePitch(nn, pitch, tpc1, tpc2));
}

Copy link
Contributor Author

@sammik sammik Oct 2, 2023

Choose a reason for hiding this comment

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

Why not:

I think

  1. becouse endNote() may by nullptr, so we would need nullcheck anyway
  2. because we dont need to change n (which is tie start note), but need to start with next tied note

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. becouse endNote() may by nullptr, so we would need nullcheck anyway

That would be done by the ; nn;.

Anyway, I'll stop nitpicking about things like this :)

@cbjeukendrup cbjeukendrup merged commit 001ce0f into musescore:master Oct 2, 2023
11 checks passed
@sammik sammik deleted the tied-accidentals branch October 2, 2023 17:45
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.

removing or adding accidental to first tied note causes wrong last tied note
4 participants