musescore / musescore/MuseScore
Undo/Redo problem with changed data, Properties panel not always updated
Nobody has claimed this yet.
- 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:
changesInfo()is called.- the last undo/redo action is replayed
changesRange()is called which in turn callschangesInfo()and that returns the previous undo/redo action's changed data.- back in the
Score::undoRedomethod, the firstchangesInfo's data is saved intorangeonly if range is empty. - 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:
-
Open a score and select an object, e.g. a text object.
-
Open the Appearance popup of the Properties panel. Change the leading for example.
-
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). -
Close and reopen the score.
-
Click the same text object and change a property other than the leading.
-
Then change the leading as before.
-
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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