From 6a934502b83dbe2df75abb7383c1f34e10612388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 20 Jul 2012 22:01:26 +0200 Subject: [PATCH] move KServiceTypeTrader::query() to main thread KConfigGroup is not the least thread safe and unfortunately the KServiceTypeTrader::self()->query() will in doubt create one if the sycoca database was damaged. BUG: 303713 REVIEW: 105608 --- scripting/scripting.cpp | 6 +++--- scripting/scripting.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 96f7cd7b4f..8786bce8dc 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -475,12 +475,12 @@ void KWin::Scripting::start() connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried())); KSharedConfig::Ptr _config = KGlobal::config(); QMap pluginStates = KConfigGroup(_config, "Plugins").entryMap(); - watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates)); + KService::List offers = KServiceTypeTrader::self()->query("KWin/Script"); + watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates, offers)); } -LoadScriptList KWin::Scripting::queryScriptsToLoad(QMap &pluginStates) +LoadScriptList KWin::Scripting::queryScriptsToLoad(QMap &pluginStates, KService::List &offers) { - KService::List offers = KServiceTypeTrader::self()->query("KWin/Script"); LoadScriptList scriptsToLoad; foreach (const KService::Ptr & service, offers) { diff --git a/scripting/scripting.h b/scripting/scripting.h index d6d56db20c..d48b3699b2 100644 --- a/scripting/scripting.h +++ b/scripting/scripting.h @@ -23,6 +23,7 @@ along with this program. If not, see . #define KWIN_SCRIPTING_H #include +#include #include #include @@ -213,7 +214,7 @@ private Q_SLOTS: void slotScriptsQueried(); private: - LoadScriptList queryScriptsToLoad(QMap &pluginStates); + LoadScriptList queryScriptsToLoad(QMap &pluginStates, KService::List &); }; }