┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index e6da0f5e0..615e52480 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -87,6 +87,7 @@
#include <QLineEdit>
#include <QMenuBar>
#include <QPushButton>
+#include <QSharedPointer>
#include <QShowEvent>
#include <QStandardPaths>
#include <QTimer>
@@ -788,8 +789,10 @@ void DolphinMainWindow::slotSaveSession()
KConfigGroup group = config->group(QStringLiteral("Number"));
group.writeEntry("NumberOfWindows", 1); // Makes session restore aware that there is a window to restore.
- auto future = QtConcurrent::run([config]() {
- config->sync();
+ // Copy the config in the main thread so sync() can safely run in the worker.
+ QSharedPointer<KConfig> configCopy(config->copyTo(config->name()));
+ auto future = QtConcurrent::run([configCopy]() {
+ configCopy->sync();
});
m_sessionSaveWatcher->setFuture(future);
}