Re: Adding tny_folder_get_folder_store and some other minor things



Philip Van Hoof wrote:
> On Thu, 2007-02-15 at 18:34 +0100, Sergio Villar Senin wrote:
>> +void
>> +_tny_camel_folder_set_folder_info (TnyFolderStore *self, TnyCamelFolder *folder, CamelFolderInfo *info)
>> +{
>> +       _tny_camel_folder_set_id (folder, info->full_name);
>> +       _tny_camel_folder_set_folder_type (folder, info);
>> +       _tny_camel_folder_set_unread_count (folder, info->unread);
>> +       _tny_camel_folder_set_all_count (folder, info->total);
>> +       _tny_camel_folder_set_name (folder, info->name);
>> +       _tny_camel_folder_set_iter (folder, info);
>>  
>> +       if (TNY_IS_CAMEL_STORE_ACCOUNT (self))
>> +       {
>> +               TnyCamelStoreAccountPriv *apriv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self);   
>> +               apriv->managed_folders = g_list_prepend (apriv->managed_folders, folder);
>> +               _tny_camel_folder_set_account (folder, TNY_ACCOUNT (self));
>> +       } else if (TNY_IS_CAMEL_FOLDER (self)) {
>> +               TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self);
>> +               _tny_camel_folder_set_account (folder, priv->account);
>> +       }
>> +       _tny_camel_folder_set_parent (folder, self);
>> +} 
> 
> 
> o. You need to add the folder to the managed_folders GList of the
> account in both cases (follow the old code).

Indeed

> o. Set priv->parent to NULL initially
> 
> o. You aren't unreferencing priv->parent in finalise? Note that
> referencing it in the _set_parent will double the reference count of
> each folder (so you must unreference it, right?)
> 
> +       priv->parent = g_object_ref (G_OBJECT (parent));
> 
> o Why this?
> 
>  static void
>  tny_camel_folder_store_add_observer (TnyFolderStore *self, TnyFolderStoreObserver *observer)
>  {
> @@ -2641,6 +2661,10 @@
>                 g_object_unref (G_OBJECT (priv->receive_strat));
>         priv->receive_strat = NULL;
>  
> +       if (G_LIKELY (priv->parent))
> +               g_object_unref (G_OBJECT (priv->parent));
> +       priv->parent = NULL;
> +
>         g_mutex_unlock (priv->folder_lock);

This belongs to the finalize method.

Br



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