diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-10-06 15:40:52 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-10-06 15:46:02 +0200 |
commit | 44de344af0564a319fbfee1dc8d5d64a75add2b9 (patch) | |
tree | fe0aae9bbf5c76bed381b161f7caf9489cccf495 | |
parent | f1dffe0991546cecf9e3b39a6f1dcb88d5af36bf (diff) | |
download | nautilus-44de344af0564a319fbfee1dc8d5d64a75add2b9.tar.gz |
application-actions: use valid window list
We were using the internal list of the application to
iterate through the windows and closing them.
Problem is that when closing one window, the list is modified,
so next time accessing the list we are accessing the "old"
list, which is invalid and makes nautilus crash.
To fix it make a copy of the list to preserve the consistency.
https://bugzilla.gnome.org/show_bug.cgi?id=755803
-rw-r--r-- | src/nautilus-application-actions.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nautilus-application-actions.c b/src/nautilus-application-actions.c index 72e31e5b2..9a4dfaaed 100644 --- a/src/nautilus-application-actions.c +++ b/src/nautilus-application-actions.c @@ -152,9 +152,14 @@ action_quit (GSimpleAction *action, /* nautilus_window_close() doesn't do anything for desktop windows */ windows = nautilus_application_get_windows (application); + /* make a copy, since the original list will be modified when destroying + * a window, making this list invalid */ + windows = g_list_copy (windows); for (l = windows; l != NULL; l = l->next) { nautilus_window_close (l->data); } + + g_list_free (windows); } static void |