Skip to content

Commit 9372da9

Browse files
committed
GUI: Ensure that the UI settings are saved before restarting Sonic Pi
* 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.
1 parent a2b1b17 commit 9372da9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/gui/qt/mainwindow.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,6 +3243,9 @@ void MainWindow::writeSettings()
32433243
gui_settings->setValue("docsplitState", docsplit->saveState());
32443244
gui_settings->setValue("windowState", saveState());
32453245
gui_settings->setValue("windowGeom", saveGeometry());
3246+
3247+
// Force Qt to write the settings to the ini file
3248+
gui_settings->sync();
32463249
}
32473250

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

33463347
// Create new process
33473348
QStringList args = qApp->arguments();

0 commit comments

Comments
 (0)