[Evolution-hackers] Memory management in mail message formatting



Hi.
I am working on the next release of the patch to show the contact photo
of the "from:" address in the mail messages (bug #360184).

I have some doubt about how memory is managed during mail message
formatting.
If I am not wrong, the formatting of single elements such as icons is
asynchronous and is managed through em_format_add_puri(), where
em_format_add_puri requests a CamelMimePart object as a parameter

Now the critical question: I create a CamelMimePart object from a memory
buffer obtained from e-d-s interaction (the contact photo from the
addressbook). The EContactPhoto is not a GObject, but just a struct that
I must free on my own (no g_objet_unref magic can help me).

The problem is that I have not a clear idea on *when* g_free must be
called. 
Freeing memory in the main thread is not a good idea and leads to random
crashes (especially when reading mailing lists in digest mode -- tried
on the currently available patch).
*Not* freeing memory seems to be even worse because it looks like a
memory leak.

Is there some document that helps me understand the inner details of
mail message formatting? Do you have any advice?

-- 
Best regards,
   Riccardo

Attachment: signature.asc
Description: Questa =?ISO-8859-1?Q?=E8?= una parte del messaggio firmata digitalmente



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]