# HG changeset patch # User Omari Stephens # Date 1499432605 0 # Node ID 3826e0c3217e210e6d093cd77cf75c5bb60463eb # Parent c972cf3f61bf9edf54509319a42f25ce98b609a4 Hopefully make it not crash diff -r c972cf3f61bf -r 3826e0c3217e src/view_file/view_file_icon.c --- a/src/view_file/view_file_icon.c Fri Jul 07 12:32:25 2017 +0000 +++ b/src/view_file/view_file_icon.c Fri Jul 07 13:03:25 2017 +0000 @@ -1859,9 +1859,9 @@ gboolean ret = TRUE; GList *work, *new_work; FileData *focus_fd; + FileData *first_selected = NULL; GList *new_filelist = NULL; - FileData *first_selected = NULL; - GList *new_iconlist = NULL; // TODO(xsdg): figure out what this should be named. + GList *new_fd_list = NULL; focus_fd = VFICON(vf)->focus_fd; @@ -1882,7 +1882,7 @@ VFICON(vf)->selection = NULL; } - /* check for same files from old_list */ + /* iterate old list and new list, looking for differences */ work = vf->list; new_work = new_filelist; while (work || new_work) @@ -1913,11 +1913,13 @@ } else if (work) { + /* old item was deleted */ fd = work->data; match = -1; } - else /* new_work */ + else { + /* new item was added */ new_fd = new_work->data; match = 1; } @@ -1943,16 +1945,17 @@ } else { - new_iconlist = g_list_prepend(new_iconlist, fd); /* it is faster to append all new entries together later */ + /* it is faster to append all new entries together later */ + new_fd_list = g_list_prepend(new_fd_list, new_fd); } new_work = new_work->next; } } - if (new_iconlist) + if (new_fd_list) { - vf->list = g_list_concat(vf->list, g_list_reverse(new_iconlist)); + vf->list = g_list_concat(vf->list, g_list_reverse(new_fd_list)); } VFICON(vf)->selection = g_list_reverse(VFICON(vf)->selection);