Changeset View
Changeset View
Standalone View
Standalone View
src/gui/kconfiggui.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | static KConfig *s_sessionConfig = nullptr; | 35 | static KConfig *s_sessionConfig = nullptr; | ||
36 | 36 | | |||
37 | KConfig *KConfigGui::sessionConfig() | 37 | KConfig *KConfigGui::sessionConfig() | ||
38 | { | 38 | { | ||
39 | #ifdef QT_NO_SESSIONMANAGER | 39 | #ifdef QT_NO_SESSIONMANAGER | ||
40 | #error QT_NO_SESSIONMANAGER was set, this will not compile. Reconfigure Qt with Session management support. | 40 | #error QT_NO_SESSIONMANAGER was set, this will not compile. Reconfigure Qt with Session management support. | ||
41 | #endif | 41 | #endif | ||
42 | if (!hasSessionConfig()) { | 42 | if (!hasSessionConfig() && qApp->isSessionRestored()) { | ||
43 | // create the default instance specific config object | 43 | // create the default instance specific config object | ||
44 | // from applications' -session command line parameter | 44 | // from applications' -session command line parameter | ||
45 | s_sessionConfig = new KConfig(configName(qApp->sessionId(), | 45 | s_sessionConfig = new KConfig(configName(qApp->sessionId(), | ||
46 | qApp->sessionKey()), | 46 | qApp->sessionKey()), | ||
47 | KConfig::SimpleConfig); | 47 | KConfig::SimpleConfig); | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | return s_sessionConfig; | 50 | return s_sessionConfig; | ||
Show All 14 Lines | |||||
65 | bool KConfigGui::hasSessionConfig() | 65 | bool KConfigGui::hasSessionConfig() | ||
66 | { | 66 | { | ||
67 | return s_sessionConfig != nullptr; | 67 | return s_sessionConfig != nullptr; | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | #if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 11) | 70 | #if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 11) | ||
71 | QString KConfigGui::sessionConfigName() | 71 | QString KConfigGui::sessionConfigName() | ||
72 | { | 72 | { | ||
73 | return sessionConfig()->name(); | 73 | return sessionConfig()->name(); | ||
anthonyfieroni: sessionConfig() can be nullptr can you add a check. | |||||
74 | } | 74 | } | ||
75 | #endif | 75 | #endif |
sessionConfig() can be nullptr can you add a check.