nautilus r15148 - in trunk: . libnautilus-private
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r15148 - in trunk: . libnautilus-private
- Date: Mon, 23 Mar 2009 10:21:14 +0000 (UTC)
Author: alexl
Date: Mon Mar 23 10:21:13 2009
New Revision: 15148
URL: http://svn.gnome.org/viewvc/nautilus?rev=15148&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-icon-container.c
trunk/libnautilus-private/nautilus-icon-private.h
Modified: trunk/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.c (original)
+++ trunk/libnautilus-private/nautilus-icon-container.c Mon Mar 23 10:21:13 2009
@@ -4001,6 +4001,11 @@
container->details->selection_changed_id = 0;
}
+ if (container->details->size_allocation_count_id != 0) {
+ g_source_remove (container->details->size_allocation_count_id);
+ container->details->size_allocation_count_id = 0;
+ }
+
/* destroy interactive search dialog */
if (container->details->search_window) {
gtk_widget_destroy (container->details->search_window);
@@ -4058,6 +4063,19 @@
requisition->height = 1;
}
+static gboolean
+clear_size_allocation_count (gpointer data)
+{
+ NautilusIconContainer *container;
+
+ container = NAUTILUS_ICON_CONTAINER (data);
+
+ container->details->size_allocation_count_id = 0;
+ container->details->size_allocation_count = 0;
+
+ return FALSE;
+}
+
static void
size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
@@ -4077,6 +4095,28 @@
need_layout_redone = TRUE;
}
+ /* Under some conditions we can end up in a loop when size allocating.
+ * This happens when the icons don't fit without a scrollbar, but fits
+ * when a scrollbar is added (bug #129963 for details).
+ * We keep track of this looping by increasing a counter in size_allocate
+ * and clearing it in a high-prio idle (the only way to detect the loop is
+ * done).
+ * When we've done at more than two iterations (with/without scrollbar)
+ * we terminate this looping by not redoing the layout when the width
+ * is wider than the current one (i.e when removing the scrollbar).
+ */
+ if (container->details->size_allocation_count_id == 0) {
+ container->details->size_allocation_count_id =
+ g_idle_add_full (G_PRIORITY_HIGH,
+ clear_size_allocation_count,
+ container, NULL);
+ }
+ container->details->size_allocation_count++;
+ if (container->details->size_allocation_count > 2 &&
+ allocation->width >= widget->allocation.width) {
+ need_layout_redone = FALSE;
+ }
+
GTK_WIDGET_CLASS (nautilus_icon_container_parent_class)->size_allocate (widget, allocation);
container->details->has_been_allocated = TRUE;
Modified: trunk/libnautilus-private/nautilus-icon-private.h
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-private.h (original)
+++ trunk/libnautilus-private/nautilus-icon-private.h Mon Mar 23 10:21:13 2009
@@ -244,6 +244,9 @@
/* Set to TRUE after first allocation has been done */
gboolean has_been_allocated;
+
+ int size_allocation_count;
+ guint size_allocation_count_id;
/* Is the container fixed or resizable */
gboolean is_fixed_size;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]