diff --git a/src/kcolorscheme.cpp b/src/kcolorscheme.cpp --- a/src/kcolorscheme.cpp +++ b/src/kcolorscheme.cpp @@ -252,9 +252,15 @@ //END default colors KSharedConfigPtr defaultConfig() { + // cache the value we'll return, since usually it's going to be the same value + static thread_local KSharedConfigPtr config; // Read from the application's color scheme file (as set by KColorSchemeManager). // If unset, this is equivalent to openConfig() and the system scheme is used. - return KSharedConfig::openConfig(qApp->property("KDE_COLOR_SCHEME_PATH").toString()); + const auto colorSchemePath = qApp->property("KDE_COLOR_SCHEME_PATH").toString(); + if (!config || config->name() != colorSchemePath) { + config = KSharedConfig::openConfig(colorSchemePath); + } + return config; } //BEGIN KColorSchemePrivate