Crash in debug build when dragging selected notes
Reported version
3.x-dev
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
Reproduce:
-
Add some notes to a new score.
-
Make a range selection of the notes
-
Attempt to click and drag one of them
-
Crash (from assert, so probably debug builds only)
OS: Ubuntu 20.04 LTS, Arch.: x86_64, MuseScore version (64-bit): 4.0.0, revision: 3543170
Fix version
3.5.0
Comments
what exactly is the failed assertion?
libmscore/select.cpp:Ms::Selection::updateSelectedElements: "ASSERT FAILED!": !isLocked() libmscore/select.cpp 514
libmscore/select.cpp:unknown: ASSERT: "!isLocked()" in file libmscore/select.cpp, line 514
and lockReason() is "drag".
Same here:
OS: openSUSE Leap 15.1, Arch.: x86_64, MuseScore version (64-bit): 3.5.0, revision: 3543170
Seems to be caused by PR5866 when the assert is included.
Caused by? Rather discovered by I think?
I can't find any information regarding
IF_ASSERT_FAILED
but looking at the context I expect it shouldn't cause a crash (which it does now) but return atrue
and usesLOGE
to print a message. So, I'm wandering theIF_ASSERT_FAILED
is correct.In reply to I can't find any information… by njvdberg
IF_ASSERT_FAILED - It's just an assert and if in one macro. It is designed to identify situations that should not occur. Assert trigger in debug build, if for handles situation for release build.
For example:
We have such a code
We expect that
ptr
should not be null, therefore, we can add an assert to detect an error.But!! If an error still occurs, then the release build will crash the program, we will turn to the null pointer.
To prevent this, we must add a check
IF_ASSERT_FAILED does exactly that
There is a problem with the implementation of the drag.
Drag works like this:
1.start drag
i.e. the current implementation of the drag assumes that during the drag, the selection should not change!
To control the selection change, I added a lock function
And now like this:
1.start drag
Users had crashed due to the fact that during the drag, the user changed the selection using the keyboard.
Therefore I added
Probably something similar happens in this case.
See https://github.com/musescore/MuseScore/pull/6069.
In reply to IF_ASSERT_FAILED - It's just… by igor.korsukov
Thanks for the explanation!
In reply to IF_ASSERT_FAILED - It's just… by igor.korsukov
@igor Thanks for the explanation on IF_ASSERT_FAILS!
Fixed in branch 3.x, commit 258b564d94
_Fix #305125: Crash in debug build when dragging selected notes
Resolves: https://musescore.org/en/node/305125_
Fixed in branch 3.x, commit af3ed8b727
_Merge pull request #6069 from mattmcclinch/305125-drag-selection
Fix #305125: Crash in debug build when dragging selected notes_
Fixed in branch master, commit 6cc520bc28
_Merge pull request #6069 from mattmcclinch/305125-drag-selection
Fix #305125: Crash in debug build when dragging selected notes_
Automatically closed -- issue fixed for 2 weeks with no activity.