hi all .. i've noticed a very common mistake in the plasmoids and spent some time fixing it everywhere i could find it today, so i figured i should pop this to the list :)
whenever DataEngine::serviceForSource is called a NEW Plasma::Service is created and returned. the service is, by default, parented to the DataEngine, so when the DataEngine goes away the service will as well. however, that is just a safety measure. when the service is no longer useful to the user of it, it really ought to be cleaned up. there are two ways to do this: if the service it going to live as long as the object (e.g. the Plasma::Applet) that is using that service, then simply do: service->setParent(this); (replace "this" with whatever object's lifetime it should match, though usually it's the this object) if the service is going to be used for just one operations call, then something like this: Plasma::Service *service = engine->serviceForSource("notification"); KConfigGroup op = service->operationDescription("someOp"); ServiceJob *job = service->startOperationCall(op); connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater())); this actually explains a lot of the "plasma's memory footprint grows slowly over time" reports. :) let's try to keep an eye on this in the future. -- Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Qt Development Frameworks
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel