Skip to content

Commit

Permalink
fix #275133: fix a crash caused by invalid selection state on single …
Browse files Browse the repository at this point in the history
…element paste
  • Loading branch information
dmitrio95 committed Nov 29, 2018
1 parent af128b5 commit 7eacacb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libmscore/paste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ void Score::cmdPaste(const QMimeData* ms, MuseScoreView* view)
else
els.append(_selection.elements());

deselectAll();

This comment has been minimized.

Copy link
@MarcSabatella

MarcSabatella Apr 27, 2019

Contributor

This caused a usability regression, see https://musescore.org/en/node/288343. If at all possible, we should preserve the selection. I suspect it's only invalid if we replace a note with another note, or maybe pasting an articulation on top of another or some special case we allow for?) How about if we skip the deselect here, but then, a few lines later when dropping the element, check if the type of element we are dropping matches that of the target, and then and only then remove the target from the selection, replacing it with the dropped element?

if (type != ElementType::INVALID) {
Element* el = Element::create(type, this);
if (el) {
Expand All @@ -897,6 +898,8 @@ void Score::cmdPaste(const QMimeData* ms, MuseScoreView* view)
if (_selection.element())
addRefresh(_selection.element()->abbox());
}
else
delete nel;
}
}
delete el;
Expand Down

0 comments on commit 7eacacb

Please sign in to comment.