Qt ownership of the service object: they are owned by the caller, and so must be deleted by them
svn path=/trunk/KDE/kdebase/runtime/; revision=1160005
This commit is contained in:
parent
7500244520
commit
0c929d525d
@ -228,7 +228,7 @@ QScriptValue JavaScriptDataEngine::serviceCtor(QScriptContext *context, QScriptE
|
||||
|
||||
JavaScriptService *service = new JavaScriptService(serviceName, iFace);
|
||||
if (service->wasFound()) {
|
||||
QScriptValue v = engine->newQObject(service, QScriptEngine::ScriptOwnership);
|
||||
QScriptValue v = engine->newQObject(service, QScriptEngine::QtOwnership);
|
||||
service->setScriptValue(v);
|
||||
return v;
|
||||
}
|
||||
@ -301,6 +301,7 @@ Plasma::Service *JavaScriptDataEngine::serviceForSource(const QString &source)
|
||||
if (service->destination().isEmpty()) {
|
||||
service->setDestination(source);
|
||||
}
|
||||
|
||||
return service;
|
||||
} else {
|
||||
delete rv.toQObject();
|
||||
|
@ -31,6 +31,11 @@ JavaScriptService::JavaScriptService(const QString &serviceName, JavaScriptDataE
|
||||
setName(serviceName);
|
||||
}
|
||||
|
||||
JavaScriptService::~JavaScriptService()
|
||||
{
|
||||
// kDebug();
|
||||
}
|
||||
|
||||
void JavaScriptService::setScriptValue(QScriptValue &v)
|
||||
{
|
||||
m_scriptValue = v;
|
||||
|
@ -38,6 +38,7 @@ class JavaScriptService : public Plasma::Service
|
||||
|
||||
public:
|
||||
JavaScriptService(const QString &serviceName, JavaScriptDataEngine *engine);
|
||||
~JavaScriptService();
|
||||
|
||||
bool wasFound() const;
|
||||
void setScriptValue(QScriptValue &v);
|
||||
|
Loading…
Reference in New Issue
Block a user