From 23d4f14601fd8ff5ca7f28b0ad245ec1935799b2 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Fri, 8 Nov 2019 09:20:22 -0700 Subject: Only create a session config when actually restoring a session Summary: This allows manually invoking session restoration logic without creating duplicate configs, in support of D25106 and https://invent.kde.org/kde/okular/merge_requests/58/ Test Plan: Apply either of the above patches and verify that it works Reviewers: #frameworks, davidedmundson Reviewed By: davidedmundson Subscribers: anthonyfieroni, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D25219 --- src/gui/kconfiggui.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gui/kconfiggui.cpp') diff --git a/src/gui/kconfiggui.cpp b/src/gui/kconfiggui.cpp index f65bba59..7eb4711e 100644 --- a/src/gui/kconfiggui.cpp +++ b/src/gui/kconfiggui.cpp @@ -39,7 +39,7 @@ KConfig *KConfigGui::sessionConfig() #ifdef QT_NO_SESSIONMANAGER #error QT_NO_SESSIONMANAGER was set, this will not compile. Reconfigure Qt with Session management support. #endif - if (!hasSessionConfig()) { + if (!hasSessionConfig() && qApp->isSessionRestored()) { // create the default instance specific config object // from applications' -session command line parameter s_sessionConfig = new KConfig(configName(qApp->sessionId(), @@ -70,6 +70,10 @@ bool KConfigGui::hasSessionConfig() #if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 11) QString KConfigGui::sessionConfigName() { - return sessionConfig()->name(); + if (sessionConfig()) { + return sessionConfig()->name(); + } else { + return QString(); + } } #endif -- cgit v1.2.1