mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
files-view: Fix double-free of file list in scripts menu
When building the scripts menu, update_directory_in_scripts_menu()
gets the list of files in the script directory, filters out hidden
files and sorts the filtered list by display name. Unlike the filtering
step, which returns a new list with ref'ed files, sorting may change
the start of the list, but not the list's actual content. As a result,
the nautilus_file_list_free() call added in commit 864c815479
tries
to free already freed memory (i.e. disposed files), resulting in a
crash when any scripts are found.
https://bugzilla.gnome.org/show_bug.cgi?id=760338
This commit is contained in:
parent
e3d2316758
commit
b49246dae8
1 changed files with 2 additions and 3 deletions
|
@ -4804,11 +4804,11 @@ update_directory_in_scripts_menu (NautilusFilesView *view,
|
|||
nautilus_file_list_free (file_list);
|
||||
menu = g_menu_new ();
|
||||
|
||||
file_list = nautilus_file_list_sort_by_display_name (filtered);
|
||||
filtered = nautilus_file_list_sort_by_display_name (filtered);
|
||||
|
||||
num = 0;
|
||||
any_scripts = FALSE;
|
||||
for (node = file_list; num < TEMPLATE_LIMIT && node != NULL; node = node->next, num++) {
|
||||
for (node = filtered; num < TEMPLATE_LIMIT && node != NULL; node = node->next, num++) {
|
||||
file = node->data;
|
||||
if (nautilus_file_is_directory (file)) {
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
@ -4838,7 +4838,6 @@ update_directory_in_scripts_menu (NautilusFilesView *view,
|
|||
}
|
||||
}
|
||||
|
||||
nautilus_file_list_free (file_list);
|
||||
nautilus_file_list_free (filtered);
|
||||
|
||||
if (!any_scripts) {
|
||||
|
|
Loading…
Reference in a new issue