KMime pointers usage / mem leaks

Sandro Knauß sknauss at kde.org
Wed Dec 30 15:24:24 GMT 2020


Hey,

when I look at MessageComposers jobs code a lot of KMime::Content pointers are 
created but often not deleted because ownership is often not that clear. Also 
I do not understand the ownership concept of KMime. 
e.g.
* Can someone explain my the ownership concept of KMime?
* Are headers been deleted if the corresponding Content is deleted? there is 
no way to express the ownership of headers. 
* If I call setContent the job should takes over ownership?
* What to do with the resultContent, this went to ownership of caller?

One of the current reasons why I want to understand is the breakage of the 
segfault in EncryptJob. I found today the patch the causes the issue[1], it is 
triggered by SinglepartJobPrivate::~SinglepartJobPrivate(), that is deleting 
headers, but not the corresponding Content. The Content is used after the job 
is deleted. The patch itself trys to get rid of mem leaks.

sandro

[1] https://invent.kde.org/pim/messagelib/-/commit/
4fff608d0bde927ac2aac61d3afedbfec4bb4b80
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20201230/e7e5a90c/attachment.sig>


More information about the kde-pim mailing list