-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This also fixes probably an error with not updating a selection in ScoreView::cmdChangeEnharmonic since the own copy was modified.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,7 +451,7 @@ void Palette::applyPaletteElement(PaletteCell* cell, Qt::KeyboardModifiers modif | |
Score* score = mscore->currentScore(); | ||
if (score == 0) | ||
return; | ||
Selection sel = score->selection(); // make a copy of the list | ||
const Selection& sel = score->selection(); // make a copy of the list | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dmitrio95
Author
Contributor
|
||
if (sel.isNone()) | ||
return; | ||
|
||
|
@@ -753,8 +753,7 @@ void Palette::mouseDoubleClickEvent(QMouseEvent* ev) | |
Score* score = mscore->currentScore(); | ||
if (score == 0) | ||
return; | ||
Selection sel = score->selection(); // make a copy of the list | ||
if (sel.isNone()) | ||
if (score->selection().isNone()) | ||
return; | ||
|
||
applyPaletteElement(cellAt(i), ev->modifiers()); | ||
|
This much creates crashes applying palette elements to list selections - see https://musescore.org/en/node/279662.
In general, the reason we do these copies is because you get crashes and other very problems when looping over a list if the code within the loop modifies the list. That's why we are so careful to create copies of lists before iterating over them in general. Probably most of these were done for that reason.