Commit 642eaed1 authored by Milan Crha's avatar Milan Crha
Browse files

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.
parent e82e9f67
...@@ -3216,10 +3216,12 @@ static void build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath pat ...@@ -3216,10 +3216,12 @@ static void build_subtree_diff (MessageList *ml, ETreePath parent, ETreePath pat
static void static void
build_tree (MessageList *ml, build_tree (MessageList *ml,
CamelFolderThread *thread, CamelFolderThread *thread,
CamelFolderChangeInfo *changes) CamelFolderChangeInfo *changes,
gboolean can_scroll_to_cursor)
{ {
gint row = 0; gint row = 0;
ETreeModel *etm = ml->model; ETreeModel *etm = ml->model;
ETableItem *table_item = e_tree_get_item (E_TREE (ml));
#ifndef BROKEN_ETREE #ifndef BROKEN_ETREE
ETreePath *top; ETreePath *top;
#endif #endif
...@@ -3259,10 +3261,23 @@ build_tree (MessageList *ml, ...@@ -3259,10 +3261,23 @@ build_tree (MessageList *ml,
clear_tree (ml, FALSE); clear_tree (ml, FALSE);
build_subtree (ml, ml->tree_root, thread->tree, &row); 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)); e_tree_memory_thaw (E_TREE_MEMORY (etm));
#ifdef BROKEN_ETREE #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); message_list_set_selected (ml, selected);
em_utils_uids_free (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
} else { } else {
static gint tree_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp); static gint tree_equal (ETreeModel *etm, ETreePath ap, CamelFolderThreadNode *bp);
...@@ -3294,7 +3309,14 @@ build_tree (MessageList *ml, ...@@ -3294,7 +3309,14 @@ build_tree (MessageList *ml,
node = parent; node = parent;
} }
e_tree_memory_freeze (E_TREE_MEMORY (etm));
e_tree_set_cursor (E_TREE (ml), node); 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); g_free (saveuid);
} else if (ml->cursor_uid && !g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) { } 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) ...@@ -4783,7 +4805,6 @@ regen_list_done (struct _regen_list_msg *m)
if (m->dotree) { if (m->dotree) {
gboolean forcing_expand_state = m->ml->expand_all || m->ml->collapse_all; 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) { if (m->ml->just_set_folder) {
m->ml->just_set_folder = FALSE; m->ml->just_set_folder = FALSE;
...@@ -4797,19 +4818,12 @@ regen_list_done (struct _regen_list_msg *m) ...@@ -4797,19 +4818,12 @@ regen_list_done (struct _regen_list_msg *m)
if (forcing_expand_state || searching) if (forcing_expand_state || searching)
e_tree_force_expanded_state (tree, (m->ml->expand_all || searching) ? 1 : -1); 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, m->scroll_to_cursor);
build_tree (m->ml, m->tree, m->changes);
if (m->ml->thread_tree) if (m->ml->thread_tree)
camel_folder_thread_messages_unref (m->ml->thread_tree); camel_folder_thread_messages_unref (m->ml->thread_tree);
m->ml->thread_tree = m->tree; m->ml->thread_tree = m->tree;
m->tree = NULL; 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 (forcing_expand_state || searching) {
if (m->ml->folder != NULL && tree != NULL && !searching) if (m->ml->folder != NULL && tree != NULL && !searching)
save_tree_state (m->ml); save_tree_state (m->ml);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment