Hi,

On Mon, 2005-10-17 at 16:48 +0530, Parthasarathi Susarla wrote:
> On Mon, 2005-10-17 at 13:04 +0200, Jules Colding wrote:
> > Hi,
> > 
> > I can see several providers implementing a *_getv() method. It seems
> > that it just provides a descriptive name of the folder in question. Is
> > that correct?
> It does a lot more than that. getv provides info based on the type of
> argument that we require to know about. This would include Total count,
> Unread count, flags, full name.....
> 
> check the 'folder_getv' method in camel-folder.c. The implementation is
> clear enough

Looking at folder_getv() raises memory handling questions. See e.g:

########### snip #############
                case CAMEL_FOLDER_ARG_NAME:
                        *arg->ca_str = folder->name;
                        break;
                case CAMEL_FOLDER_ARG_UID_ARRAY: {
                        int j;
                        CamelMessageInfo *info;
                        GPtrArray *array;

                        count = camel_folder_summary_count(folder->summary);
                        array = g_ptr_array_new();
                        g_ptr_array_set_size(array, count);
                        for (j=0; j<count; j++) {
                                if ((info = 
camel_folder_summary_index(folder->summary, j))) {
                                        array->pdata[i] = 
g_strdup(camel_message_info_uid(info));
                                        camel_message_info_free(info);
                                }
                        }
                        *arg->ca_ptr = array;
                        break; }

########### snip #############

arg->ca_ptr must be freed while folder->name is managed by the folder
instance. Whom is responsible for freeing the GPtrArray ?

Thanks,
  jules


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

Reply via email to