Skip to content

Commit

Permalink
GUI: Ensure that the UI settings are saved before restarting Sonic Pi
Browse files Browse the repository at this point in the history
* Fixes an issue where the settings wouldn't be saved when restarting
after selecting a new language.
* Also, remove the unnecessary delay in restartApp(). Cleanup should be
complete when onExitCleanup() returns.
  • Loading branch information
SunderB committed Apr 27, 2021
1 parent a2b1b17 commit 9372da9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/gui/qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3243,6 +3243,9 @@ void MainWindow::writeSettings()
gui_settings->setValue("docsplitState", docsplit->saveState());
gui_settings->setValue("windowState", saveState());
gui_settings->setValue("windowGeom", saveGeometry());

// Force Qt to write the settings to the ini file
gui_settings->sync();
}

void MainWindow::loadFile(const QString& fileName, SonicPiScintilla*& text)
Expand Down Expand Up @@ -3339,9 +3342,7 @@ void MainWindow::restartApp() {
// Save settings and perform some cleanup
writeSettings();
onExitCleanup();
std::cout << "Performing application restart... please wait..." << std::endl;
// Allow cleanup to complete
std::this_thread::sleep_for(2s);
std::cout << "Performing application restart..." << std::endl;

// Create new process
QStringList args = qApp->arguments();
Expand Down

0 comments on commit 9372da9

Please sign in to comment.