Commit e3edcbcf authored by Thomas Lübking's avatar Thomas Lübking
Browse files

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
parent e82da344
......@@ -475,12 +475,12 @@ void KWin::Scripting::start()
connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried()));
KSharedConfig::Ptr _config = KGlobal::config();
QMap<QString,QString> 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<QString,QString> &pluginStates)
LoadScriptList KWin::Scripting::queryScriptsToLoad(QMap<QString,QString> &pluginStates, KService::List &offers)
KService::List offers = KServiceTypeTrader::self()->query("KWin/Script");
LoadScriptList scriptsToLoad;
foreach (const KService::Ptr & service, offers) {
......@@ -23,6 +23,7 @@ along with this program. If not, see <>.
#include <kwinglobals.h>
#include <kservice.h>
#include <QtCore/QFile>
#include <QtCore/QHash>
......@@ -213,7 +214,7 @@ private Q_SLOTS:
void slotScriptsQueried();
LoadScriptList queryScriptsToLoad(QMap<QString,QString> &pluginStates);
LoadScriptList queryScriptsToLoad(QMap<QString,QString> &pluginStates, KService::List &);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment