Changeset 3309

Show
Ignore:
Timestamp:
01/29/08 16:53:37
Author:
pvanhoof
Message:

2008-01-29 Philip Van Hoof <pvanhoof@gnome.org>

        • Fixed reference counting for all TnyIterator implementations
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3304 r3309  
     12008-01-29  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Fixed reference counting for all TnyIterator implementations 
     4 
    152008-01-28  Philip Van Hoof <pvanhoof@gnome.org> 
    26 
  • trunk/libtinymail/tny-simple-list-iterator.c

    r3304 r3309  
    3636        TnySimpleListPriv *lpriv; 
    3737 
    38         self->model = model; 
    39  
    4038        lpriv = TNY_SIMPLE_LIST_GET_PRIVATE (self->model); 
    4139 
    4240        g_mutex_lock (lpriv->iterator_lock); 
     41        self->model = (TnySimpleList *) g_object_ref (self->model); 
    4342        self->current = lpriv->first; 
    4443        g_mutex_unlock (lpriv->iterator_lock); 
     
    6261tny_simple_list_iterator_instance_init (GTypeInstance *instance, gpointer g_class) 
    6362{ 
    64         TnySimpleListIterator *self = (TnySimpleListIterator *)instance; 
     63        TnySimpleListIterator *self = (TnySimpleListIterator *) instance; 
    6564 
    6665        self->model = NULL; 
     
    7372tny_simple_list_iterator_finalize (GObject *object) 
    7473{ 
     74 
     75        TnySimpleListIterator *self = (TnySimpleListIterator *) object; 
     76 
     77        if (self->model) 
     78                g_object_unref (self->model); 
     79 
    7580        (*parent_class->finalize) (object); 
    7681 
  • trunk/libtinymailui-gtk/tny-gtk-account-list-model-iterator.c

    r3304 r3309  
    3232_tny_gtk_account_list_model_iterator_set_model (TnyGtkAccountListModelIterator *self, TnyGtkAccountListModel *model) 
    3333{ 
    34         self->model = model
     34        self->model = (TnyGtkAccountListModel *) g_object_ref (model)
    3535        self->current = model->first; 
    3636 
     
    6464tny_gtk_account_list_model_iterator_finalize (GObject *object) 
    6565{ 
     66        TnyGtkAccountListModelIterator *self = (TnyGtkAccountListModelIterator *) object; 
     67 
     68        if (self->model) 
     69                g_object_unref (self->model); 
     70 
    6671        (*parent_class->finalize) (object); 
    6772 
     
    190195                return NULL; 
    191196 
    192                g_object_ref (G_OBJECT (me->model)); 
     197       g_object_ref (me->model); 
    193198 
    194199        return TNY_LIST (me->model); 
  • trunk/libtinymailui-gtk/tny-gtk-attach-list-model-iterator.c

    r3304 r3309  
    3333_tny_gtk_attach_list_model_iterator_set_model (TnyGtkAttachListModelIterator *self, TnyGtkAttachListModel *model) 
    3434{ 
    35         self->model = model
     35        self->model = (TnyGtkAttachListModel *) g_object_ref (model)
    3636        self->current = model->first; 
    3737 
     
    6565tny_gtk_attach_list_model_iterator_finalize (GObject *object) 
    6666{ 
     67        TnyGtkAttachListModelIterator *self = (TnyGtkAttachListModelIterator *) object; 
     68 
     69        if (self->model) 
     70                g_object_unref (self->model); 
     71 
    6772        (*parent_class->finalize) (object); 
    6873 
  • trunk/libtinymailui-gtk/tny-gtk-folder-store-tree-model-iterator.c

    r3304 r3309  
    3232_tny_gtk_folder_store_tree_model_iterator_set_model (TnyGtkFolderStoreTreeModelIterator *self, TnyGtkFolderStoreTreeModel *model) 
    3333{ 
    34         self->model = model
     34        self->model = (TnyGtkFolderStoreTreeModel *) g_object_ref (model)
    3535        self->current = model->first; 
    3636 
     
    6464tny_gtk_folder_store_tree_model_iterator_finalize (GObject *object) 
    6565{ 
     66        TnyGtkFolderStoreTreeModelIterator *self = (TnyGtkFolderStoreTreeModelIterator *) object; 
     67 
     68        if (self->model) 
     69                g_object_unref (self); 
     70 
    6671        (*parent_class->finalize) (object); 
    6772 
     
    174179 
    175180        if (ptr) 
    176                 g_object_ref (G_OBJECT(ptr)); 
     181                g_object_ref (ptr); 
    177182         
    178183        return G_OBJECT(ptr); 
  • trunk/libtinymailui-gtk/tny-gtk-header-list-iterator.c

    r3304 r3309  
    3333_tny_gtk_header_list_iterator_set_model (TnyGtkHeaderListIterator *self, TnyGtkHeaderListModel *model) 
    3434{ 
    35         self->model = model; 
     35 
     36        self->model = (TnyGtkHeaderListModel *) g_object_ref (model); 
    3637 
    3738        /* It's not a list_copy, so don't free this list when  
     
    7374tny_gtk_header_list_iterator_finalize (GObject *object) 
    7475{ 
     76        TnyGtkHeaderListIterator *self = (TnyGtkHeaderListIterator *) object; 
     77 
     78        if (self->model) 
     79                g_object_unref (self->model); 
     80 
    7581        (*parent_class->finalize) (object); 
    7682