diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index d5dceb03f4..91bfc02dde 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1176,7 +1176,14 @@ void MainWindow::closeEvent (QCloseEvent * e) /*emit*/ mainWindowClosed(); d->activityTimer->stop(); - saveWindowSettings(); + + // https://forum.freecadweb.org/viewtopic.php?f=8&t=67748 + // When the session manager jumps in it can happen that the closeEvent() + // function is triggered twice and for the second call the main window might be + // invisible. In this case the window settings shouldn't be saved. + if (isVisible()) + saveWindowSettings(); + delete d->assistant; d->assistant = nullptr;