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 #290546: corruption on copy/paste end final mmrest #5191

Merged
merged 1 commit into from
Jul 2, 2019

Conversation

MarcSabatella
Copy link
Contributor

See https://musescore.org/en/node/290546

Problem is simple: when selecting to the end of a score that ends in an mmrest, we are setting "ls" to the last segment of the score, but that's not right - if there hadn't been an mmrest, ls would have been nullptr. That's the usual convention - the "last segment" pointer is supposed to be the segment after the selection, or to nullkptr, so that loops can stop before that specified segment. And that's where the corruption comes in - we're stopping before the last segment of the score, which in this case is the measure rest in the underlying piece (there's no barline in the underlying measure if it hasn't been laid out yet).

Anyhow, that's the fix - setting "ls" to nullptr rather than lastSegment(). Potentially this change could have been made in the selection code rather than here, but that would have greater impact on other things and risk regressions.

@dmitrio95
Copy link
Contributor

That's the usual convention - the "last segment" pointer is supposed to be the segment after the selection

Isn't this usually referred to as end segment (or measure, or whatever)? The word "last" seems to mean usually that it refers to the last really used item, so in this case the variable name looks incorrect to me.

Anyway, the fix itself should be totally correct.

@MarcSabatella
Copy link
Contributor Author

Good point. Since this obviously caused some confusion at some point, I'll rename the parameters and push an update.

@MarcSabatella
Copy link
Contributor Author

(pushed)

@dmitrio95 dmitrio95 merged commit b552efc into musescore:master Jul 2, 2019
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.

None yet

2 participants