Skip to content

Commit

Permalink
fix #309333: crash hiding palettes
Browse files Browse the repository at this point in the history
Resolves: https://musescore.org/en/node/309333

Crash happens on trying to set the focus upon closing the palette,
we try to restore the previous focused widget.
But it may no longer be valid.

Changed to return focus to the score view if possible,
otherwise let Qt worry about it.
  • Loading branch information
MarcSabatella authored and vpereverzev committed Jan 25, 2021
1 parent b542650 commit 0c907ab
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6009,14 +6009,10 @@ void MuseScore::cmd(QAction* a)
}
if (cmdn == "toggle-palette") {
showPalette(a->isChecked());
if (a->isChecked()) {
lastFocusWidget = QApplication::focusWidget();
if (a->isChecked())
paletteWidget->activateSearchBox();
}
else {
if (lastFocusWidget)
lastFocusWidget->setFocus();
}
else if (cv)
cv->setFocus();
return;
}
if (cmdn == "palette-search") {
Expand Down

0 comments on commit 0c907ab

Please sign in to comment.