backport more fixes
[alioth/musescore.git] / debian / patches / backports / crash-F9.diff
1 Origin: backport, commit:0c907ab8222859a645d9a2549da7d18ef11f8326
2 Author: Marc Sabatella <marc@outsideshore.com>
3 Description: fix #309333: crash hiding palettes
4  Resolves: https://musescore.org/en/node/309333
5  .
6  Crash happens on trying to set the focus upon closing the palette,
7  we try to restore the previous focused widget.
8  But it may no longer be valid.
9  .
10  Changed to return focus to the score view if possible,
11  otherwise let Qt worry about it.
12
13 --- a/mscore/musescore.cpp
14 +++ b/mscore/musescore.cpp
15 @@ -5791,17 +5791,14 @@ void MuseScore::cmd(QAction* a)
16              PaletteBox* pb = mscore->getPaletteBox();
17              QLineEdit* sb = pb->searchBox();
18              if (a->isChecked()) {
19 -                  lastFocusWidget = QApplication::focusWidget();
20                    sb->setFocus();
21                    if (pb->noSelection())
22                          pb->setKeyboardNavigation(false);
23                    else
24                          pb->setKeyboardNavigation(true);
25                    }
26 -            else {
27 -                  if (lastFocusWidget)
28 -                        lastFocusWidget->setFocus();
29 -                  }
30 +            else if (cv)
31 +                  cv->setFocus();
32              return;
33              }
34        if (cmdn == "palette-search") {
35 --- a/mscore/musescore.h
36 +++ b/mscore/musescore.h
37 @@ -349,7 +349,6 @@ class MuseScore : public QMainWindow, pu
38        PaletteBox* paletteBox         { 0 };
39        Inspector* _inspector          { 0 };
40        OmrPanel* omrPanel             { 0 };
41 -      QWidget* lastFocusWidget       { 0 };
42  
43        QPushButton* showMidiImportButton {0};
44