Hi,

The GW provider has this code snippet in
camel-groupwise-folder.c:gw_update_cache():

############# snip ###############
                mi = (CamelGroupwiseMessageInfo *)camel_folder_summary_uid 
(folder->summary, id);
                if (mi) {
                        exists = TRUE;
                        camel_message_info_free (&mi->info); // <== unref
                }

                if (!exists) {
                        type = e_gw_item_get_item_type (item);
                        if ((type == E_GW_ITEM_TYPE_CONTACT) || (type == 
E_GW_ITEM_TYPE_UNKNOWN)) {
                                exists = FALSE;
                                continue;
                        }

                        mi = camel_message_info_new (folder->summary); 
                        if (mi->info.content == NULL) {
                                mi->info.content = 
camel_folder_summary_content_info_new (folder->summary);
                                mi->info.content->type = camel_content_type_new 
("multipart", "mixed");
                        }
                }
################## snip ##################

What I do not understand is that "mi" is being unref-ed right after
having confirmed that mi indeed is a reference to an existing message
info. The source then proceeds to populate mi with new data without
releasing the pre-existing data in the info (such as "to", "from" and
"subject").

The mi structure members are just being overwritten. Doesn't this lead
to memory leaks?

Another thing is that the "mi" structure can suddenly vanish if another
thread unrefs it.

This shouldn't work if my reading of the source is correct, so I must
obviously be missing something very fundamental here :-(

Could someone please help me understand what I am missing?

Thanks a lot,
  jules


_______________________________________________
Evolution-hackers mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-hackers

Reply via email to