[gtk] layoutmanager: Never pass NULL pointers to ->measure



commit 4134b6782731612b1425c3f679b2c5f01d83d7f8
Author: Timm Bäder <mail baedert org>
Date:   Sat May 25 08:59:20 2019 +0200

    layoutmanager: Never pass NULL pointers to ->measure
    
    We don't do that in GtkWidgetClass::measure() implementations either, so
    make the semantics match.

 gtk/gtklayoutmanager.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklayoutmanager.c b/gtk/gtklayoutmanager.c
index c82d8f88d8..1325c339ba 100644
--- a/gtk/gtklayoutmanager.c
+++ b/gtk/gtklayoutmanager.c
@@ -264,6 +264,11 @@ gtk_layout_manager_measure (GtkLayoutManager *manager,
                             int              *natural_baseline)
 {
   GtkLayoutManagerClass *klass;
+  int min_size = 0;
+  int nat_size = 0;
+  int min_baseline = -1;
+  int nat_baseline = -1;
+
 
   g_return_if_fail (GTK_IS_LAYOUT_MANAGER (manager));
   g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -272,8 +277,20 @@ gtk_layout_manager_measure (GtkLayoutManager *manager,
 
   klass->measure (manager, widget, orientation,
                   for_size,
-                  minimum, natural,
-                  minimum_baseline, natural_baseline);
+                  &min_size, &nat_size,
+                  &min_baseline, &nat_baseline);
+
+  if (minimum)
+    *minimum = min_size;
+
+  if (natural)
+    *natural = nat_size;
+
+  if (minimum_baseline)
+    *minimum_baseline = min_baseline;
+
+  if (natural_baseline)
+    *natural_baseline = nat_baseline;
 }
 
 /**


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