Drag or delete some elements when the page is empty in Continuous View causes a crash
GIT commit: e044f26 / Windows7
1) "My First Score"
2) Select all (Ctrl + A)
3) Delete (Ctrl + Del)
4) Toggle in Continuous View
5) Drag a barline from the palette onto the page
Result: crash
Same result with elements of "Breaks & Spacers" palette at step #5
- Related scenario: same four initial steps, then:
5) Drag a line (voltas, hairpins etc.) or a frame (horizontal, etc.) onto the empty page
Result: the lines or the frames remain on the spot.
6) Right-click on these elements (or first, left-click, if difficult to select, then right-click).
(Sometimes, only right-click on an element leads to the crash)
7) Cut
Result: crash
Comments
New scenario:
0. Empty score with a title
1. CMD+A
2. CMD+Del
3. Switch to continuous view
Result: Crash.
relates to #272135: [EPIC] Continuous view issues
New scenario:
Ctrl + A
Ctrl + Del
Results: Crash.
This case is for continuous view and page view.
None of these scenarios result in a crash for me (on macOS, building from the latest sources). If I remove all measures and frames, the page will disappear. I am fine with this, since the page will reappear if I append measures or frames from the Add menu, or undo the delete. But I can cause a crash by doing one of the following:
- Save the score in .mscz format (or wait until autosave kicks in) when there is no page
- Add text from the Add menu when there is no page
- Add a text frame from the Add menu, and click inside the text frame when there are no measures
I have simple fixes for all of these. But I am surprised that handrok can still cause a crash with his scenario.
I take it back. I do get a crash when following Anatoly's steps. And I get a crash when following handrok's steps in Continuous View. I believe there does need to be a title frame in order for the crash to occur, as Anatoly indicates. If I follow handrok's steps in Page View, I have to delete the title frame as well, and then wait for the autosave timer, and then I get a crash.
I'm taking a look at this, I've slowly traced it back to inside LayoutContext::layoutLinear(). I'll see if I can fix it.
I've already fixed it. I'm about about to submit a pull request.
In reply to I've already fixed it. I… by mattmcclinch
Oh, that's a shame. It was because it was trying to get system->measures.front(), which was undefined (because system->measures was empty), wasn't it? And it was fixable by checking if system->measures was empty and then if it was, by setting stick and etick to 0 and -1 respectively, right?
See https://github.com/musescore/MuseScore/pull/3891.
I thought it best to not call LayoutContext::layoutLinear() if there were no measures.
In reply to I thought it best to not… by mattmcclinch
Ah, that makes more sense than my fix.
Fixed in branch master, commit 0b246c48f4
fix #122226: Crashes related to having no measures in the score
Fixed in branch master, commit 624714741f
Merge pull request #3891 from mattmcclinch/122226-no-measures
fix #122226: Crashes related to having no measures in the score
Hmm... I still have a crash during the following scenario:
Ctrl + A
Ctrl + Del
Results: Crash.
OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit): 3.0.0, revision: 55e0a7a
Seems I have crash only in Visual Studio debug mode. Nightly build is ok
handrok, is this still an issue as of today? It sounds like 3598e95 may have addressed this.
I have checked this scenario. Crash disappeared.
Automatically closed -- issue fixed for 2 weeks with no activity.