summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-06-15 14:27:12 -0400
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-06-15 14:27:12 -0400
commit1b2e9124f0bd7fde11e2b6faad6e75c38da1abe1 (patch)
tree060aa96349e87cfb107bb8df794ba2c5c185cdef
parentb238c0124ae0ff49548a80f55a449eeb14fb7559 (diff)
downloadgdk-pixbuf-1b2e9124f0bd7fde11e2b6faad6e75c38da1abe1.tar.gz
Fixed negative allocations from gtk_box_size_allocate()
Fixed the allocation loop to check if it was allocated at least enough space to hold its visible children before going and distributing extra space among children. Fixes bgo #617444.
-rw-r--r--gtk/gtkbox.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index f16b7c434..c506fedf8 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -517,7 +517,6 @@ gtk_box_size_allocate (GtkWidget *widget,
*/
/* Sort descending by gap and position. */
-
g_qsort_with_data (spreading,
nvis_children, sizeof (GtkBoxSpreading),
gtk_box_compare_gap, sizes);
@@ -525,7 +524,7 @@ gtk_box_size_allocate (GtkWidget *widget,
/* Distribute available space.
* This master piece of a loop was conceived by Behdad Esfahbod.
*/
- for (i = nvis_children - 1; i >= 0; --i)
+ for (i = nvis_children - 1; size > 0 && i >= 0; --i)
{
/* Divide remaining space by number of remaining children.
* Sort order and reducing remaining space by assigned space
@@ -1061,7 +1060,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
/* Distribute available space.
* This master piece of a loop was conceived by Behdad Esfahbod.
*/
- for (i = nvis_children - 1; i >= 0; --i)
+ for (i = nvis_children - 1; size > 0 && i >= 0; --i)
{
/* Divide remaining space by number of remaining children.
* Sort order and reducing remaining space by assigned space