After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755803 - unsafe window list handling
unsafe window list handling
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Crashers
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-29 18:10 UTC by Matthias Clasen
Modified: 2015-10-06 13:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
application-actions: use valid window list (1.36 KB, patch)
2015-10-06 13:43 UTC, Carlos Soriano
committed Details | Review

Description Matthias Clasen 2015-09-29 18:10:24 UTC
I have seen a downstream bug with a nautilus crash that looks like this:

Thread 1 (Thread 0x3fff9af09e0 (LWP 22780))

  • #0 action_quit
    at nautilus-application-actions.c line 187
  • #1 g_closure_invoke
    at gclosure.c line 768
  • #2 signal_emit_unlocked_R
    at gsignal.c line 3553
  • #3 g_signal_emit_valist
    at gsignal.c line 3309
  • #4 g_signal_emit
    at gsignal.c line 3365
  • #5 g_simple_action_activate
    at gsimpleaction.c line 211
  • #6 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 411


Looking briefly at the code of action_quit, it seems to me that it is not handling the window list in a safe way. You iterate over the list, and call nautilus_window_close. That might well cause the window to be destroyed, and during that process it will be removed from the applications window list, and your list may not be valid anymore.
Comment 1 Carlos Soriano 2015-10-06 13:43:57 UTC
Created attachment 312732 [details] [review]
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.
Comment 2 Carlos Soriano 2015-10-06 13:46:54 UTC
Thanks Mathias for the analysis.
Pushed to 3.18, 3.16 and 3.14

Attachment 312732 [details] pushed as 44de344 - application-actions: use valid window list