[nautilus] application-actions: use valid window list
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] application-actions: use valid window list
- Date: Tue, 6 Oct 2015 13:46:27 +0000 (UTC)
commit 44de344af0564a319fbfee1dc8d5d64a75add2b9
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Oct 6 15:40:52 2015 +0200
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
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 72e31e5..9a4dfaa 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]