From 5f0afdd61c711b9acc6708e64eec922f58740a58 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 8 Feb 2008 19:21:25 +0000 Subject: [PATCH] * prevent potential crash introduced with scripting support (non-init'd AbstractRunner*) * get the args right svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=772449 --- abstractrunner.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/abstractrunner.cpp b/abstractrunner.cpp index 016f54063..2581365c0 100644 --- a/abstractrunner.cpp +++ b/abstractrunner.cpp @@ -199,7 +199,7 @@ void AbstractRunner::match(Plasma::SearchContext *search) QString AbstractRunner::runnerName() const { if (!d->runnerDescription.isValid()) { - return QString(); + return objectName(); } return d->runnerDescription.property("X-Plasma-RunnerName").toString(); } @@ -219,17 +219,19 @@ AbstractRunner::List AbstractRunner::loadRunners(QObject* parent, const QStringL KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner"); QString error; - QVariantList allArgs; foreach (KService::Ptr service, offers) { - if( whitelist.empty() || whitelist.contains( service->name() ) ) { - allArgs << service->storageId(); + if (whitelist.empty() || whitelist.contains(service->name())) { QString language = service->property("X-Plasma-Language").toString(); - AbstractRunner* runner; + AbstractRunner* runner = 0; + if (language.isEmpty()) { - runner = service->createInstance(parent, allArgs, &error); + QVariantList args; + args << service->storageId(); + runner = service->createInstance(parent, args, &error); } else { runner = new AbstractRunner(parent, service->storageId()); } + if (runner) { //kDebug() << "loaded runner : " << service->name(); QString phase = service->property("X-Plasma-RunnerPhase").toString(); @@ -240,8 +242,7 @@ AbstractRunner::List AbstractRunner::loadRunners(QObject* parent, const QStringL } else { runners.append(runner); } - } - else { + } else { kDebug() << "failed to load runner : " << service->name() << ". error reported: " << error; } }