[gtk+] Fix improperly unwinded loops



commit 35105ab2b44c50a96698cc55a77a68c2e816f56b
Author: Tadej Borovšak <tadeboro gmail com>
Date:   Sat Aug 7 01:58:29 2010 +0200

    Fix improperly unwinded loops

 gtk/gtkbox.c |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index be08900..cdc5f1d 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -542,12 +542,19 @@ gtk_box_size_allocate (GtkWidget     *widget,
 	{
 	  child = children->data;
 
-	  /* If widget is not visible or it's packing is not right for current
-	   * loop, skip it.
-	   */
-	  if (child->pack != packing || !gtk_widget_get_visible (child->widget))
+	  /* If widget is not visible, skip it. */
+	  if (!gtk_widget_get_visible (child->widget))
 	    continue;
 
+	  /* If widget is packed differently skip it, but still increment i,
+	   * since widget is visible and will be handled in next loop iteration.
+	   */
+	  if (child->pack != packing)
+	    {
+	      i++;
+	      continue;
+	    }
+
 	  /* Assign the child's size. */
 	  if (private->homogeneous)
 	    {
@@ -1020,9 +1027,19 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
 	{
 	  child = children->data;
 
-	  if (child->pack != packing || !gtk_widget_get_visible (child->widget))
+	  /* If widget is not visible, skip it. */
+	  if (!gtk_widget_get_visible (child->widget))
 	    continue;
 
+	  /* If widget is packed differently skip it, but still increment i,
+	   * since widget is visible and will be handled in next loop iteration.
+	   */
+	  if (child->pack != packing)
+	    {
+	      i++;
+	      continue;
+	    }
+
 	  if (child->pack == packing)
 	    {
 	      /* Assign the child's size. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]