[gtk+] headerbar: Avoid allocating 0 visible children



commit 8c0e5adaab3f38de31d44dd50bcc8179b17c8b4a
Author: Timm Bäder <mail baedert org>
Date:   Mon Aug 28 11:07:35 2017 +0200

    headerbar: Avoid allocating 0 visible children
    
    Ths avoids doing a bunch of work as well as passing 0 to g_alloca which
    is undefined.

 gtk/gtkheaderbar.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 5b8ca74..bfaf41b 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -932,6 +932,10 @@ gtk_header_bar_size_allocate (GtkWidget           *widget,
 
   direction = gtk_widget_get_direction (widget);
   nvis_children = count_visible_children (bar);
+
+  if (nvis_children == 0)
+    return;
+
   sizes = g_newa (GtkRequestedSize, nvis_children);
 
   width = allocation->width - nvis_children * priv->spacing;


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