D21121: Fix leaking of requests in ItemRetriever::exec()
David Faure
noreply at phabricator.kde.org
Fri May 10 16:34:14 BST 2019
dfaure added a comment.
I don't really like shared_ptr for things like this. To me shared_ptr means "ownership is unclear" (when misused) or "ownership is shared between multiple objects, we need refcounting so that the last user deletes it".
This isn't the case here. ItemRetriever creates the requests, ItemRetrievalManager processes them (but never owns them), and then we need to delete them after use.
A refcount is unnecessary (i.e. overkill) and makes it harder to find out the ownership situation by reading the code.
The owner is clear and unique: it's the `requests` list. Hence the `delete` after the `removeOne`.
REVISION DETAIL
https://phabricator.kde.org/D21121
To: dfaure, dvratil
Cc: anthonyfieroni, kde-pim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20190510/cb711825/attachment.html>
More information about the kde-pim
mailing list