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);
|
JavaScriptService *service = new JavaScriptService(serviceName, iFace);
|
||||||
if (service->wasFound()) {
|
if (service->wasFound()) {
|
||||||
QScriptValue v = engine->newQObject(service, QScriptEngine::ScriptOwnership);
|
QScriptValue v = engine->newQObject(service, QScriptEngine::QtOwnership);
|
||||||
service->setScriptValue(v);
|
service->setScriptValue(v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@ -301,6 +301,7 @@ Plasma::Service *JavaScriptDataEngine::serviceForSource(const QString &source)
|
|||||||
if (service->destination().isEmpty()) {
|
if (service->destination().isEmpty()) {
|
||||||
service->setDestination(source);
|
service->setDestination(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
} else {
|
} else {
|
||||||
delete rv.toQObject();
|
delete rv.toQObject();
|
||||||
|
@ -31,6 +31,11 @@ JavaScriptService::JavaScriptService(const QString &serviceName, JavaScriptDataE
|
|||||||
setName(serviceName);
|
setName(serviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JavaScriptService::~JavaScriptService()
|
||||||
|
{
|
||||||
|
// kDebug();
|
||||||
|
}
|
||||||
|
|
||||||
void JavaScriptService::setScriptValue(QScriptValue &v)
|
void JavaScriptService::setScriptValue(QScriptValue &v)
|
||||||
{
|
{
|
||||||
m_scriptValue = v;
|
m_scriptValue = v;
|
||||||
|
@ -38,6 +38,7 @@ class JavaScriptService : public Plasma::Service
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
JavaScriptService(const QString &serviceName, JavaScriptDataEngine *engine);
|
JavaScriptService(const QString &serviceName, JavaScriptDataEngine *engine);
|
||||||
|
~JavaScriptService();
|
||||||
|
|
||||||
bool wasFound() const;
|
bool wasFound() const;
|
||||||
void setScriptValue(QScriptValue &v);
|
void setScriptValue(QScriptValue &v);
|
||||||
|
Loading…
Reference in New Issue
Block a user