musescore / musescore/MuseScore

Undo/Redo problem with changed data, Properties panel not always updated

Open
#25,342 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3 UI
Dominant language
C++
Stars
15.1k
Forks
3.3k
Avg merge
2d 2h
Merged PRs (30d)
91

Description

Issue type

UI bug (incorrect info or interface appearance)

Description with steps to reproduce

I think I have found a problem with the notifications of Undo/Redo actions. It seems like the entry on top of the stack gets skipped and the notifications are sent out for the next entry. The code I am referring to is the void Score::undoRedo(bool undo, EditData* ed) method in Undo.cpp. From what I see:

  1. changesInfo() is called.
  2. the last undo/redo action is replayed
  3. changesRange() is called which in turn calls changesInfo() and that returns the previous undo/redo action's changed data.
  4. back in the Score::undoRedo method, the first changesInfo's data is saved into range only if range is empty.
  5. Notifications are sent for range. This means that if the Undo action is not the only one in the stack, its modified properties are skipped and those of the next action are used instead.

I am far from an Undo/Redo expert and might be wrong / missing something but I'd be glad if someone looked at this and shed some light. Here is an actual observable bug that supports my findings:

  1. Open a score and select an object, e.g. a text object.

  2. Open the Appearance popup of the Properties panel. Change the leading for example.

  3. Press Undo.
    Result: the leading is correctly undone in the score and the previous value is restored in the Properties panel. (The undo action was the only action on the stack).

  4. Close and reopen the score.

  5. Click the same text object and change a property other than the leading.

  6. Then change the leading as before.

  7. Click Unfo.
    Result: the leading is undone in the score but not in the Properties panel. (The undo was not the last action on the stack.)

Supporting files, videos and screenshots

None.

What is the latest version of MuseScore Studio where this issue is present?

4.4.3

Regression

I was unable to check

Operating system

Windows 10

Additional context

No response

Checklist
  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Undo.cpp at void Score::undoRedo(bool undo, EditData* ed), then trace changesInfo(), changesRange(), and how range is populated before notifications are sent. Reproduce the two property-edit scenarios described in the issue; done means undoing a non-last action sends notifications for that action's changed data and the Properties panel updates accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.