Re: [Evolution-hackers] Memory management in mail message formatting



Riccardo,

IIRC while solving some inline image crashes, I came across a similiar
issue. For that I added a free function to the puri, which gets called
when the puri is freed. You can see em-format.h:119

You can use this to achieve what you need.

-Srini

On Wed, 2007-02-28 at 19:54 +0100, Riccardo Lancellotti wrote:
> 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?
> 
> _______________________________________________
> Evolution-hackers mailing list
> Evolution-hackers gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-hackers




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