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 129963 - nautilus locks up during window resize (compact mode)
nautilus locks up during window resize (compact mode)
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Views: Icon View
2.13.x
Other All
: Normal critical
: 2.14.x
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 160128 312998 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-12-24 20:06 UTC by deglog
Modified: 2009-03-23 18:16 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Lock-up in icon layout code; astable state 1. (89.67 KB, image/png)
2009-03-21 05:56 UTC, Зоран Рилак
  Details
Lock-up in icon layout code; astable state 2. (89.61 KB, image/png)
2009-03-21 05:59 UTC, Зоран Рилак
  Details
Makes the rows in tighter layout (Compact layout in GUI) padded so they fill the icon canvas. As a side effect, it fixes bug 129963. (1.43 KB, patch)
2009-03-22 19:20 UTC, Зоран Рилак
none Details | Review
Flowing compact layout; solves 129963. (1.43 KB, patch)
2009-03-23 00:01 UTC, Зоран Рилак
none Details | Review
Fix for 129963 (1.71 KB, patch)
2009-03-23 10:05 UTC, Зоран Рилак
none Details | Review

Description deglog 2003-12-24 20:06:54 UTC
In icon view mode, and in the home directory, nautilus locks up if I try to
create a new directory. I have to kill the window to close it, then if I
open a new one, that locks up immediately.

Same effect if I move one (home) directory into another (home) directory.
Comment 1 deglog 2003-12-24 20:50:08 UTC
After more experimentation, I think this is to do with the size of the
directory window relative to what is in it.

I can get nautilus to lock just be resizing the window to the
'correct' size. 

If the window size is sufficiently far from this correct value, I have
no problem creating or moving directories.
Comment 2 deglog 2003-12-26 19:38:27 UTC
Recipe for creating bug (sufficient):

Create a directory, put 31 subdirectories in it, and 4 files. Select
icon view, compact layout. Have different directory name lengths.
Re-size the window so that there are 5 rows (and no more). Some rows
should have 8 directories, other rows 7 (because of different name
lengths). Re-size the window height (in small steps) until the
vertical scroll bar disappears.  Nautilus will probably lock now, if
not try re-sizing wider.
Comment 3 Ricardo Fernández Pascual 2004-10-05 17:33:21 UTC
I see this bug quite often too.

Here is a backtrace of a locked up Nautilus obtained with SIGABRT:

Thread 1 (Thread -150960992 (LWP 11200))

  • #0 ??
  • #1 __waitpid_nocancel
    from /lib/tls/libpthread.so.0
  • #2 libgnomeui_module_info_get
    from /usr/lib/libgnomeui-2.so.0
  • #3 <signal handler called>
  • #4 XUnlockDisplay
    from /usr/X11R6/lib/libX11.so.6
  • #5 _XRead
    from /usr/X11R6/lib/libX11.so.6
  • #6 _XReply
    from /usr/X11R6/lib/libX11.so.6
  • #7 _XPollfdCacheDel
    from /usr/X11R6/lib/libX11.so.6
  • #8 XMoveResizeWindow
    from /usr/X11R6/lib/libX11.so.6
  • #9 gdk_window_scroll
    from /usr/lib/libgdk-x11-2.0.so.0
  • #10 gdk_window_move_resize
    from /usr/lib/libgdk-x11-2.0.so.0
  • #11 gtk_layout_get_type
    from /usr/lib/libgtk-x11-2.0.so.0
  • #12 eel_canvas_new
    from /usr/lib/libeel-2.so.2
  • #13 nautilus_icon_container_move_icon
    from /usr/lib/libnautilus-private.so.2
  • #14 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #16 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #17 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #18 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #19 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #20 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #21 gtk_scrolled_window_get_shadow_type
    from /usr/lib/libgtk-x11-2.0.so.0
  • #22 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #23 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #24 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #25 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #26 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #27 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #28 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #29 gtk_plug_get_id
    from /usr/lib/libgtk-x11-2.0.so.0
  • #30 bonobo_plug_set_control
    from /usr/lib/libbonoboui-2.so.0
  • #31 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #32 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #33 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #34 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #35 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #36 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #37 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #38 gtk_socket_get_id
    from /usr/lib/libgtk-x11-2.0.so.0
  • #39 bonobo_socket_disposed
    from /usr/lib/libbonoboui-2.so.0
  • #40 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #41 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #42 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #43 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #44 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #45 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #46 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #47 gtk_hbox_new
    from /usr/lib/libgtk-x11-2.0.so.0
  • #48 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #49 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #50 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #51 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #52 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #53 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #54 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #55 gtk_hbox_new
    from /usr/lib/libgtk-x11-2.0.so.0
  • #56 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #57 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #58 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #59 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #60 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #61 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #62 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #63 bonobo_dock_get_type
    from /usr/lib/libbonoboui-2.so.0
  • #64 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #65 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #66 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #67 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #68 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #69 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #70 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #71 gtk_vbox_new
    from /usr/lib/libgtk-x11-2.0.so.0
  • #72 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #73 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #74 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #75 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #76 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #77 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #78 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #79 gtk_window_reshow_with_initial_size
    from /usr/lib/libgtk-x11-2.0.so.0
  • #80 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #81 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #82 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #83 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #84 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #85 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #86 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #87 gtk_container_resize_children
    from /usr/lib/libgtk-x11-2.0.so.0
  • #88 gtk_window_propagate_key_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #89 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #90 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #91 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #92 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #93 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #94 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #95 gtk_container_check_resize
    from /usr/lib/libgtk-x11-2.0.so.0
  • #96 gtk_container_set_reallocate_redraws
    from /usr/lib/libgtk-x11-2.0.so.0
  • #97 g_child_watch_add
    from /usr/lib/libglib-2.0.so.0
  • #98 g_main_depth
    from /usr/lib/libglib-2.0.so.0
  • #99 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #100 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #101 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #102 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #103 main
  • #0 ??

Comment 4 Matthew Gatto 2004-11-04 09:36:12 UTC
Ricardo: you get that when resizing a nautilus window? Maybe this is a duplicate
of bug 122141.
Comment 5 Ricardo Fernández Pascual 2004-11-04 09:49:21 UTC
Yes, I get this when resizing some windows. But also when opening certain
folders (not 100% reproducible, but some folders trigger this bug most times).

This happens only with the "compact layout" (or at least I haven't been able to
reproduce the bug without it).

I don't think this is a duplicate of 122141, here nautilus doesn't crash, it
just locks up.
Comment 6 Daniel Lundell 2004-11-13 22:56:00 UTC
In Fedora Core 3, Nautilus still locks up (uses 100% cpu) when folder windows
are resized (sometimes). Is there anything I can do to help getting this fixed?
Comment 7 Mark R. Pariente 2004-11-30 20:12:39 UTC
I have this as well, with GNOME 2.8.1 (Gentoo). I think it has been there since
GNOME 2.6, having this bug since quite a long time.

The bug is definitely related to Compact mode, and occurs when resizing certain
windows. In some cases, after the 100% cpu hang and killing nautilus, the same
directory window can be opened without problems (although the resize is rolled
back). In other cases, opening the same directory results in 100% cpu hang
immediately, and the size of the directory is as intended (resize worked).
Comment 8 Pekka Tiittanen 2005-08-09 11:34:44 UTC
2.10 does include this bug also. And it's a very, very annoying one. I'd love to
use compact layout, but this bug prevents using compact layout.
Comment 9 Sebastien Bacher 2005-08-09 12:10:41 UTC
*** Bug 312998 has been marked as a duplicate of this bug. ***
Comment 10 John Spray 2005-08-15 10:32:03 UTC
Getting a 100% CPU freeze resizing a window which is NOT in compact mode here. 
Attached gdb, got a backtrace.  It seemed to me that it froze when the window
became wide enough to fit one extra column of icons at the right.

Perhaps this is the same, perhaps it is different.  But it seems pretty similar.

(gdb) bt
  • #0 malloc
    from /lib/tls/i686/cmov/libc.so.6
  • #1 g_malloc
    from /usr/lib/libglib-2.0.so.0
  • #2 gdk_region_intersect
    from /usr/lib/libgdk-x11-2.0.so.0
  • #3 gdk_region_union
    from /usr/lib/libgdk-x11-2.0.so.0
  • #4 gdk_window_invalidate_maybe_recurse
    from /usr/lib/libgdk-x11-2.0.so.0
  • #5 gdk_window_invalidate_maybe_recurse
    from /usr/lib/libgdk-x11-2.0.so.0
  • #6 gdk_window_invalidate_maybe_recurse
    from /usr/lib/libgdk-x11-2.0.so.0
  • #7 gdk_window_invalidate_region
    from /usr/lib/libgdk-x11-2.0.so.0
  • #8 gdk_window_invalidate_rect
    from /usr/lib/libgdk-x11-2.0.so.0
  • #9 gtk_widget_queue_draw_area
    from /usr/lib/libgtk-x11-2.0.so.0
  • #10 gtk_widget_queue_draw
    from /usr/lib/libgtk-x11-2.0.so.0
  • #11 _gtk_range_get_wheel_delta
    from /usr/lib/libgtk-x11-2.0.so.0
  • #12 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #13 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #14 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #16 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #17 gtk_adjustment_changed
    from /usr/lib/libgtk-x11-2.0.so.0
  • #18 gtk_layout_move
    from /usr/lib/libgtk-x11-2.0.so.0
  • #19 gtk_layout_get_type
    from /usr/lib/libgtk-x11-2.0.so.0
  • #20 eel_canvas_new
    from /usr/lib/libeel-2.so.2
  • #21 nautilus_icon_container_move_icon
    from /usr/lib/libnautilus-private.so.2
  • #22 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #23 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #24 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #25 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #26 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #27 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #28 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #29 gtk_scrolled_window_get_shadow_type
    from /usr/lib/libgtk-x11-2.0.so.0
  • #30 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #31 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #32 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #33 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #34 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #35 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #36 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #37 gtk_hbox_new
    from /usr/lib/libgtk-x11-2.0.so.0
  • #38 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #39 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #40 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #41 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #42 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #43 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #44 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #45 gtk_table_get_homogeneous
    from /usr/lib/libgtk-x11-2.0.so.0
  • #46 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #47 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #48 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #49 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #50 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #51 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #52 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #53 gtk_window_reshow_with_initial_size
    from /usr/lib/libgtk-x11-2.0.so.0
  • #54 g_cclosure_marshal_VOID__BOXED
    from /usr/lib/libgobject-2.0.so.0
  • #55 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #56 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #57 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #58 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #59 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #60 gtk_widget_size_allocate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #61 _gtk_window_unset_focus_and_default
    from /usr/lib/libgtk-x11-2.0.so.0
  • #62 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #63 g_cclosure_new_swap
    from /usr/lib/libgobject-2.0.so.0
  • #64 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #65 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #66 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #67 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #68 gtk_container_check_resize
    from /usr/lib/libgtk-x11-2.0.so.0
  • #69 gtk_container_set_reallocate_redraws
    from /usr/lib/libgtk-x11-2.0.so.0
  • #70 g_child_watch_add
    from /usr/lib/libglib-2.0.so.0
  • #71 g_main_depth
    from /usr/lib/libglib-2.0.so.0
  • #72 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #73 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #74 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #75 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #76 main

Comment 11 Marc E. 2005-08-15 21:58:12 UTC
I can confirm the lock up, when randomnly resizing a window excessively.
Comment 12 Christian Neumair 2005-10-03 11:28:51 UTC
While I could this still verify this for Nautilus 2.12.0, I was unable to
reproduce it with Nautilus 2.12.1, probably due to the icon container layout
fixes we committed that also prevent Nautilus from displaying a horizontal
scrollbar that possbily triggered an endless size change recursion for the
container.
Comment 13 Christian Neumair 2005-10-03 12:40:04 UTC
*** Bug 160128 has been marked as a duplicate of this bug. ***
Comment 14 Mark R. Pariente 2005-10-16 20:29:13 UTC
I have reproduced this bug with nautilus 2.12.1. In fact I have found a way to
consistently reproduce it:

Nautilus 2.12.1, default settings, enable "compact mode".
- Create a new folder.
- Open the folder
- Create 5 new folders in it, folder1 through folder5
- Copy 4 PNG files in (previewed, larger than folder icon)
- Copy a PDF file in (with dimensions like an A4 paper, previewed)
- Resize the folder for a while (fullscreen, very small etc.)
- Eventually I get 100% cpu by nautilus.

I believe this bug is still there, think the bug should be reopened. Can anyone
confirm?
Comment 15 Christian Neumair 2005-10-16 20:40:20 UTC
Thanks for your info Mark, I can still reproduce it. Reopening.
Comment 16 Chris Koresko 2007-04-26 01:18:47 UTC
Time to take another look at this.  I am seeing the 100% CPU usage and unresponsive Nautilus here with 2.16.3.  This happens frequently when using Compact layout, and less frequently with normal layout.

I suspect that the program is going into an infinite loop trying to find an optimal layout for the icons in the folder.  If so, then one simple workaround may be to put an upper limit on the number of loop iterations allowed for computing the layout.

This bug can be fairly easily reproduced for a given folder which contains many icons.  Just grab one corner of the Nautilus window and slowly move the mouse around in a roughly circular pattern, so that Nautilus reflows the icons frequently.  This procedure is not guaranteed to work, however, since triggering the bug seems to involve hitting a particular combination of icons and window size.

Sometimes one finds that Nautilus will hang this way consistently when one attempts to display a folder.  I believe you can work around this by displaying a different folder, resizing Nautilus, closing Nautilus, and then viewing the problematic folder.  Alternatively, one can create a file that's displayed early  (e.g., by doing 'touch 00' in the problematic folder) to change the layout enough to avoid the hang.

This bug has been around since version 2.0.  It's a pretty long-lived one for being so nasty and so well reported!



Comment 17 Зоран Рилак 2009-03-21 05:56:36 UTC
Created attachment 131068 [details]
Lock-up in icon layout code; astable state 1.

This is how the icons are originally laid out: notice the tall thumbnail in the second row.  It is tall enough to push the third line below the bottom of the allocation size.
Comment 18 Зоран Рилак 2009-03-21 05:59:10 UTC
Created attachment 131069 [details]
Lock-up in icon layout code; astable state 2.

This is what the layout code comes up with when it notices that there isn't enough room for the canvas in the current allocation.  A taller but narrower area is allocated, which surprisingly manages to fit all the icons and remain with some room extra.  So the scrollbar isn't needed anymore, it goes away, and we go back to state 1.
Comment 19 Зоран Рилак 2009-03-21 06:05:43 UTC
I have also been a long-suffering subject of this one particular bug, so I
whipped out gdb and went into a bug hunt.  I did find what was causing it, but
how to fix it, now that's a different matter altogether.

The problem lies in icon view's layout mechanism.  It can be reproduced fairly
easily by following these steps:
- Open a Nautilus window showing compact icon view of an empty directory.
- Create a handful of directories in it.  (It is not necessary that these be
directories, but their icons are small and suitable for the purpose here)
- Toss in one file with a tall thumbnail (portrait images and PDFs work well
for this purpose).
- Add another file to the directory that is *taller* than a directory
thumbnail, but *shorter* than the tall thumbnail we just put in.  (This is
important.)  Rename it so that alphabetically it comes after the tall thumbnail
file.
- You should now have a bunch of directories, one tall thumbnail, and one not
so tall thumbnail in your window.  Enlarge the window vertically so there's
ample space below the contents, but fit the width in such a manner that the
tall thumbnail is the only icon "sticking out" on the right side.  It has to be
the last icon in a row, and it has to be as close to the edge as possible. 
(You can rename some directories -- which changes the icon's size -- to make it
happen.)  The tall icon needs, in effect, to sit on the area where the
scrollbar appears.
- Make sure that the mid-sized file is sitting alone on the last line. 
Decrease the window height until you begin to cover that last file.  Nautilus
hangs.

The explanation is rather simple: layout code notices when the allocation size
becomes larger than the canvas, so it allocates a new region, longer but
narrower by the scrollbar's width.  However, by doing that, the tall icon from
the next-to-last row can't fit in that row anymore; it flows onto the last row,
which becomes only a little taller (thanks to the small difference in height
between the two files), but the next-to-last row, having lost the tall icon,
becomes significantly shorter (owing to the big difference in height between
the tall icon and the directory icons).  This causes the canvas to draw itself
on an area that is shorter than the allocation, rendering the scrollbar
unnecessary.  Thus a new layout is fired, with the original allocation; the
tall icon again pushes the last line just out of the allocation border, and the
sequence repeats (ad nauseam).

I took two screenshots illustrating the principle; they are in the attachments.
 Note that these are actual screenshots of the issue, only some critical blocks
of code have been commented out, so I can photograph the two fighting layouts
in slo-mo.

I looked a bit into the code and it seems that it doesn't do any good to add a
fixed margin to any of the layout components -- EelCanvas,
NautilusIconContainer -- because that would just relocate the "magic" width at
which directories like the one I described throw the layout code into a fit. 
The only thing I could come up with, after having spent two frustrating days
with the old (and unmaintained?) Eazel code, was to change the vertical
scrollbar policy in fm_directory_view_init to ALWAYS.  This does solve the
issue -- there can be no more trespassing on the scrollbar zone -- but can't
possibly be called a solution.

I leave this matter in more capable hands now. :)
Comment 20 Зоран Рилак 2009-03-21 06:07:41 UTC
The explanation is rather simple: layout code notices when the allocation size
becomes larger than the canvas

Diff: should be "becomes *smaller* than the canvas".
Comment 21 Зоран Рилак 2009-03-22 19:20:48 UTC
Created attachment 131134 [details] [review]
Makes the rows in tighter layout (Compact layout in GUI) padded so they fill the icon canvas.  As a side effect, it fixes bug 129963.

This patch will make Compact layout views to flow the icons border-to-border, leaving no gap between the last icon in a row and the right edge of the canvas.

This behavior might be undesired -- please test and let me know if I should pursue this line any further (it may still cause the bug 129963 to appear if a row is 1 pixel wider than other rows due to rounding, that needs to be investigated).
Comment 22 Зоран Рилак 2009-03-23 00:01:31 UTC
Created attachment 131146 [details] [review]
Flowing compact layout; solves 129963.

I speak of rounding errors, and use int to declare a padding constant. :)
Comment 23 Зоран Рилак 2009-03-23 10:05:07 UTC
Created attachment 131168 [details] [review]
Fix for 129963

Well, my previous "fix" wasn't a fix at all; it just made the issue harder to spot.  Here is a true solution, an ugly one to be sure, but it does avoid the endless re-laying out of the NautilusIconContainer.  Side effects may include extraneous scrollbars in those situations which would otherwise cause the container to oscillate between the two geometries.

I am still pretty sure that there is a better way to do this.  Can I haz feedback?

P.S.  I still like the "flowing" layout from the previous attachment.  If you have a chance, please do test it and consider it as a modification to the Compact view.
Comment 24 Alexander Larsson 2009-03-23 10:22:22 UTC
Thanks for tracking this down, especially with the testcase. Fixed in trunk:

2009-03-23  Alexander Larsson  <alexl@redhat.com>

	Bug 129963 – nautilus locks up during window resize (compact mode)

        * libnautilus-private/nautilus-icon-container.c:
        * libnautilus-private/nautilus-icon-private.h:
	Work around possible infinite loop when relayouting by counting
	the number of iterations. This could happen in certain cases in
	with the compat mode. We use a clear-counter-at-idle-hack to detect
	the end of the loop.
Comment 25 Зоран Рилак 2009-03-23 18:16:52 UTC
An excellent fix, Alex; I was finally on the right track, but you killed it with the grace of an experienced dev. :)