Skip to content

Fix cmdDeleteTuplet: use first element tick instead of (corrupt) tuplet tick#33366

Open
manolo wants to merge 2 commits into
musescore:masterfrom
manolo:fix/cmdDeleteTuplet-wrong-tick
Open

Fix cmdDeleteTuplet: use first element tick instead of (corrupt) tuplet tick#33366
manolo wants to merge 2 commits into
musescore:masterfrom
manolo:fix/cmdDeleteTuplet-wrong-tick

Conversation

@manolo
Copy link
Copy Markdown
Contributor

@manolo manolo commented May 12, 2026

Resolves: #33360

Tuplet::tick() can return 0 on imported scores because several importers do not call setTick() on Tuplet objects, leaving Tuplet::m_tick at its default value. When cmdDeleteTuplet calls setRest(tuplet->tick(), ...) it places the replacement rest at tick 0 instead of the actual tuplet position, silently corrupting the score (notes at measure 1 beat 1 are overwritten).

Confirmed with MIDI import. Likely also affects OVE, GuitarPro and TableEdit imports, which also skip setTick() on tuplets.

Fix: save the tick from the first element BEFORE removing elements and use that instead of tuplet->tick().

  • 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)

…et tick

Tuplet::tick() can be wrong on MIDI-imported scores because the MIDI importer
does not call setTick() on Tuplet objects, leaving Tuplet::m_tick at its default
value of 0. When cmdDeleteTuplet calls setRest(tuplet->tick(), ...) it places
the replacement rest at tick 0 instead of the actual tuplet position, silently
corrupting the score.

Fix: save the tick from the first element BEFORE removing elements and use that
instead of tuplet->tick(). Falls back to tuplet->tick() if the elements list is
empty (unchanged behaviour).

Fixes musescore#33360
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown
Contributor

@mathesoncalum mathesoncalum left a comment

Choose a reason for hiding this comment

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

I think we should address this in our importers and prevent the corrupted tick from happening in the first place. It shouldn't matter how a tuplet was created, the deletion implementation should be the same.

@Jojo-Schmitz
Copy link
Copy Markdown
Contributor

Jojo-Schmitz commented May 13, 2026

I believe you should rebase it to main (rather than master), if alone for it to show in the issue as fixing it

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.

4 participants