Changeset 3502

Show
Ignore:
Timestamp:
03/18/08 14:46:30
Author:
pvanhoof
Message:
        • Fixed race condition in case re-selecting the same folder
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3500 r3502  
    33        * Non-initialization of a variable caused memory corruption on the 
    44        stack 
     5        * Fixed race condition in case re-selecting the same folder 
    56 
    672008-03-17  Sergio Villar Senin  <svillar@igalia.com> 
  • trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.c

    r3497 r3502  
    874874{ 
    875875        if (!(mi->flags & CAMEL_MESSAGE_INFO_NEEDS_FREE)) { 
    876                 mi->subject = " "; 
    877                 mi->to = " "; 
    878                 mi->from = " "; 
    879                 mi->cc = " "; 
     876                mi->subject = "..."; 
     877                mi->to = "..."; 
     878                mi->from = "..."; 
     879                mi->cc = "..."; 
    880880        } 
    881881}  
  • trunk/libtinymailui-gtk/tny-gtk-header-list-model.c

    r3470 r3502  
    10761076#endif 
    10771077 
     1078static gboolean 
     1079free_items (gpointer user_data) 
     1080{ 
     1081        GPtrArray *copy = user_data; 
     1082 
     1083#ifdef DEBUG_EXTRA 
     1084        g_ptr_array_foreach (copy, (GFunc) forea, NULL); 
     1085#else 
     1086        g_ptr_array_foreach (copy, (GFunc) g_object_unref, NULL); 
     1087#endif 
     1088        g_ptr_array_free (copy, TRUE); 
     1089 
     1090        return FALSE; 
     1091} 
     1092 
     1093static inline void  
     1094copy_them (gpointer data, gpointer user_data) { g_ptr_array_add ((GPtrArray *) user_data, data); } 
    10781095 
    10791096static void 
     
    10821099        TnyGtkHeaderListModel *self = (TnyGtkHeaderListModel *) object; 
    10831100        TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self); 
     1101        GPtrArray *copy = g_ptr_array_new (); 
    10841102 
    10851103        g_static_rec_mutex_lock (priv->iterator_lock); 
     
    10961114        remove_del_timeouts (self); 
    10971115 
    1098 #ifdef DEBUG_EXTRA 
    1099         g_ptr_array_foreach (priv->items, (GFunc) forea, NULL); 
    1100 #else 
    1101         g_ptr_array_foreach (priv->items, (GFunc) g_object_unref, NULL); 
    1102 #endif 
     1116        g_ptr_array_foreach (priv->items, (GFunc) copy_them, copy); 
     1117 
     1118        g_timeout_add (5*1000, free_items, copy); 
     1119 
    11031120 
    11041121        if (priv->folder) 
     
    12301247        GtkTreeIter iter; 
    12311248        GtkTreePath *path; 
     1249        GPtrArray *copy_items; 
    12321250 
    12331251        g_static_rec_mutex_lock (priv->iterator_lock); 
     
    12451263         * assertion is placed there, in stead of a normal return, though) */ 
    12461264  
    1247         g_ptr_array_foreach (priv->items, (GFunc) g_object_unref, NULL); 
     1265        copy_items = priv->items; 
     1266        priv->registered = 0; 
     1267        priv->items = g_ptr_array_sized_new (tny_folder_get_all_count (folder)); 
    12481268        if (priv->folder) 
    12491269                g_object_unref (priv->folder); 
    12501270        priv->folder = TNY_FOLDER (g_object_ref (folder)); 
    1251         priv->registered = 0; 
    1252         g_ptr_array_free (priv->items, TRUE); 
    1253         priv->items = g_ptr_array_sized_new (tny_folder_get_all_count (folder)); 
    1254  
    12551271        g_static_rec_mutex_unlock (priv->iterator_lock); 
    12561272 
     
    12641280 
    12651281        g_static_rec_mutex_lock (priv->iterator_lock); 
     1282 
     1283        g_ptr_array_foreach (copy_items, (GFunc) g_object_unref, NULL); 
     1284        g_ptr_array_free (copy_items, TRUE); 
    12661285 
    12671286        /* Reference the new folder instance */