let's see if serializing (via a mutex) access to kservicetypetrader helps with those kservicetypetrader related crashes i'm seeing constantly go away

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=768454
This commit is contained in:
Aaron J. Seigo 2008-01-30 03:41:36 +00:00
parent 9df86adbd2
commit 099785fbdc
2 changed files with 26 additions and 1 deletions

View File

@ -18,11 +18,15 @@
*/
#include "abstractrunner.h"
#include "searchcontext.h"
#include <QMutex>
#include <QMutexLocker>
#include <KDebug>
#include <KServiceTypeTrader>
#include "searchcontext.h"
namespace Plasma
{
@ -147,6 +151,14 @@ void AbstractRunner::setPriority(Priority priority)
d->priority = priority;
}
QMutex serviceTypeTraderLock;
KService::List AbstractRunner::serviceQuery(const QString &serviceType, const QString &constraint) const
{
QMutexLocker lock(&serviceTypeTraderLock);
return KServiceTypeTrader::self()->query(serviceType, constraint);
}
void AbstractRunner::exec(Plasma::SearchMatch *action)
{
Q_UNUSED(action)

View File

@ -24,6 +24,7 @@
#include <QtCore/QStringList>
#include <KDE/KConfigGroup>
#include <KDE/KService>
#include <plasma/plasma_export.h>
#include <plasma/searchmatch.h>
@ -193,6 +194,18 @@ class PLASMA_EXPORT AbstractRunner : public QObject
*/
void setPriority(Priority newPriority);
/**
* A thread safe (blocking) method to do queries of installed Services
*
* @arg serviceType a service type like "Plasma/Applet" or "KFilePlugin"
* @arg constraint a constraint to limie the the choices returned.
* @see KServiceTypeTrader::query(const QString&, const QString&)
*
* @return a list of services that satisfy the query.
*/
KService::List serviceQuery(const QString &serviceType,
const QString &constraint = QString()) const;
private:
class Private;
Private* const d;