[evolution] Fix a regression from the previous commit for bug #645476



commit 642eaed17fcc9aa6b8cbd5c0fcf8916e29ab39e3
Author: Milan Crha <mcrha redhat com>
Date:   Tue Mar 5 07:58:37 2013 +0100

    Fix a regression from the previous commit for bug #645476
    
    Evolution could crash when changing message view, like when
    toggling Show Deleted messages. This effectively reverts
    the previous commit and propagates the same changes further
    in the code.

 mail/message-list.c |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/mail/message-list.c b/mail/message-list.c
index 0885af6..cc23f99 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -3216,10 +3216,12 @@ static void build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath pat
 static void
 build_tree (MessageList *ml,
             CamelFolderThread *thread,
-            CamelFolderChangeInfo *changes)
+            CamelFolderChangeInfo *changes,
+           gboolean can_scroll_to_cursor)
 {
        gint row = 0;
        ETreeModel *etm = ml->model;
+       ETableItem *table_item = e_tree_get_item (E_TREE (ml));
 #ifndef BROKEN_ETREE
        ETreePath *top;
 #endif
@@ -3259,10 +3261,23 @@ build_tree (MessageList *ml,
                clear_tree (ml, FALSE);
 
                build_subtree (ml, ml->tree_root, thread->tree, &row);
+
+               if (!can_scroll_to_cursor && table_item)
+                       table_item->queue_show_cursor = FALSE;
+
                e_tree_memory_thaw (E_TREE_MEMORY (etm));
 #ifdef BROKEN_ETREE
+
+               /* it's required to thaw & freeze, to propagate changes */
+               e_tree_memory_freeze (E_TREE_MEMORY (etm));
+
                message_list_set_selected (ml, selected);
                em_utils_uids_free (selected);
+
+               if (!can_scroll_to_cursor && table_item)
+                       table_item->queue_show_cursor = FALSE;
+
+               e_tree_memory_thaw (E_TREE_MEMORY (etm));
 #else
        } else {
                static gint tree_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp);
@@ -3294,7 +3309,14 @@ build_tree (MessageList *ml,
                                        node = parent;
                        }
 
+                       e_tree_memory_freeze (E_TREE_MEMORY (etm));
+
                        e_tree_set_cursor (E_TREE (ml), node);
+
+                       if (!can_scroll_to_cursor && table_item)
+                               table_item->queue_show_cursor = FALSE;
+
+                       e_tree_memory_thaw (E_TREE_MEMORY (etm));
                }
                g_free (saveuid);
        } else if (ml->cursor_uid && !g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) {
@@ -4783,7 +4805,6 @@ regen_list_done (struct _regen_list_msg *m)
 
        if (m->dotree) {
                gboolean forcing_expand_state = m->ml->expand_all || m->ml->collapse_all;
-               ETableItem *table_item = e_tree_get_item (E_TREE (m->ml));
 
                if (m->ml->just_set_folder) {
                        m->ml->just_set_folder = FALSE;
@@ -4797,19 +4818,12 @@ regen_list_done (struct _regen_list_msg *m)
                if (forcing_expand_state || searching)
                        e_tree_force_expanded_state (tree, (m->ml->expand_all || searching) ? 1 : -1);
 
-               e_tree_memory_freeze (E_TREE_MEMORY (m->ml->model));
-
-               build_tree (m->ml, m->tree, m->changes);
+               build_tree (m->ml, m->tree, m->changes, m->scroll_to_cursor);
                if (m->ml->thread_tree)
                        camel_folder_thread_messages_unref (m->ml->thread_tree);
                m->ml->thread_tree = m->tree;
                m->tree = NULL;
 
-               if (!m->scroll_to_cursor && table_item)
-                       table_item->queue_show_cursor = FALSE;
-
-               e_tree_memory_thaw (E_TREE_MEMORY (m->ml->model));
-
                if (forcing_expand_state || searching) {
                        if (m->ml->folder != NULL && tree != NULL && !searching)
                                save_tree_state (m->ml);


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