Skip to content

Commit

Permalink
fix crash on changing workspaces when installing/removing extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly-os committed Sep 30, 2019
1 parent 3c2cb77 commit 4e75169
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ bool MuseScore::importExtension(QString path)
if (!wsList.isEmpty()) {
Workspace::refreshWorkspaces();
emit workspacesChanged();
paletteBox->selectWorkspace(wsList.last().absoluteFilePath());
changeWorkspace(Workspace::workspaces().last());
}
}
return true;
Expand Down Expand Up @@ -889,9 +889,22 @@ bool MuseScore::uninstallExtension(QString extensionId)
mscore->reloadInstrumentTemplates();
mscore->updateInstrumentDialog();
if (refreshWorkspaces) {
const auto& curWorkspaceName = Workspace::currentWorkspace->name();
Workspace::refreshWorkspaces();
emit workspacesChanged();
paletteBox->selectWorkspace(-1);
auto workspaces = Workspace::workspaces();
//If current worksapce is alive, do nothing

This comment has been minimized.

Copy link
@RobFog

RobFog Sep 30, 2019

  • workspace
//Select first available workspace in the list otherwise
bool curWorkspaceDisappeared = true;
for (auto workspace : workspaces) {
if (workspace->name() == curWorkspaceName) {
curWorkspaceDisappeared = false;
break;
}
}
if (curWorkspaceDisappeared)
changeWorkspace(Workspace::workspaces().last());
//paletteBox->selectWorkspace(-1);
}
return true;
}
Expand Down

0 comments on commit 4e75169

Please sign in to comment.