Changeset 2943

Show
Ignore:
Timestamp:
11/13/07 21:58:02
Author:
pvanhoof
Message:
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2941 r2943  
    33        * Weak references for TnyHeader instances in TnyCamelMsgHeader 
    44        * Reference counting mistakes in TnyGtkFolderStoreTreeModel 
     5        * Reference counting mistakes in TnyGtkAccountListModel 
    56 
    672007-11-12  Vivek Sekar  <viveksekar@gmail.com> 
  • trunk/libtinymailui-gtk/tny-gtk-account-list-model.c

    r2825 r2943  
    5858} 
    5959 
    60 static void  
    61 destroy_accs (gpointer item, gpointer user_data) 
    62 { 
    63         if (item && G_IS_OBJECT (item)) 
    64                 g_object_unref (G_OBJECT (item)); 
    65         return; 
    66 } 
    6760 
    6861static void 
     
    7366        g_mutex_lock (me->iterator_lock); 
    7467        if (me->first) 
    75         { 
    76                 g_list_foreach (me->first, destroy_accs, NULL); 
    77                 g_list_free (me->first); me->first = NULL; 
    78         } 
     68                g_list_free (me->first); 
     69        me->first = NULL; 
    7970        g_mutex_unlock (me->iterator_lock); 
    8071 
     
    134125 
    135126        g_mutex_lock (me->iterator_lock); 
    136         g_object_ref (G_OBJECT (item)); 
    137         me->first = g_list_prepend (me->first, item);     
    138127        gtk_list_store_prepend (store, &iter); 
    139128        gtk_list_store_set (store, &iter,  
    140129                TNY_GTK_ACCOUNT_LIST_MODEL_NAME_COLUMN, tny_account_get_name (account), 
    141130                TNY_GTK_ACCOUNT_LIST_MODEL_INSTANCE_COLUMN, account, -1);  
     131        me->first = g_list_prepend (me->first, item);     
    142132        g_mutex_unlock (me->iterator_lock); 
    143133} 
     
    152142 
    153143        g_mutex_lock (me->iterator_lock); 
    154         g_object_ref (G_OBJECT (item));  
    155         me->first = g_list_append (me->first, item);     
    156144        gtk_list_store_append (store, &iter); 
    157145        gtk_list_store_set (store, &iter,  
    158146                TNY_GTK_ACCOUNT_LIST_MODEL_NAME_COLUMN, tny_account_get_name (account), 
    159147                TNY_GTK_ACCOUNT_LIST_MODEL_INSTANCE_COLUMN, account, -1);     
     148        me->first = g_list_append (me->first, item);     
    160149        g_mutex_unlock (me->iterator_lock); 
    161150} 
     
    187176 
    188177        g_mutex_lock (me->iterator_lock); 
    189          
     178 
    190179        me->first = g_list_remove (me->first, (gconstpointer)item); 
    191180 
     
    202191                { 
    203192                        gtk_list_store_remove (GTK_LIST_STORE (me), &iter); 
    204                         g_object_unref (G_OBJECT (item)); 
     193                        g_object_unref (citem); 
    205194                        break; 
    206195                } 
    207                 g_object_unref (G_OBJECT (citem)); 
     196                g_object_unref (citem); 
    208197          } 
    209198 
  • trunk/libtinymailui-gtk/tny-gtk-folder-store-tree-model.c

    r2941 r2943  
    492492} 
    493493 
    494 static void  
    495 destroy_folder_stores (gpointer item, gpointer user_data) 
    496 { 
    497         if (item && G_IS_OBJECT (item)) 
    498                 g_object_unref (G_OBJECT (item)); 
    499         return; 
    500 } 
    501494 
    502495 
     
    528521        g_mutex_lock (me->iterator_lock); 
    529522        if (me->first) 
    530         { 
    531                 g_list_foreach (me->first, destroy_folder_stores, NULL); 
    532                 g_list_free (me->first); me->first = NULL; 
    533         } 
     523                g_list_free (me->first);  
     524        me->first = NULL; 
    534525        g_mutex_unlock (me->iterator_lock); 
    535526 
     
    603594 
    604595        /* Prepend something to the list */ 
    605         g_object_ref (item); 
    606596        me->first = g_list_prepend (me->first, item); 
    607597 
     
    621611 
    622612        /* Prepend something to the list */ 
    623         g_object_ref (item); 
    624613        me->first = g_list_prepend (me->first, item); 
    625614 
     
    646635 
    647636        /* Append something to the list */ 
    648         g_object_ref (item); 
    649637        me->first = g_list_append (me->first, item); 
    650638 
     
    663651 
    664652        /* Append something to the list */ 
    665         g_object_ref (item); 
    666653        me->first = g_list_append (me->first, item); 
    667654