measure: don't leave dangling references
We were removing both the width and height
constraints here, but only adding one set
back (depending on orientation), leaving
the other one as dangling references.
diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c
index 14b8fa6..b37f51c 100644
--- a/gtk/gtkconstraintlayout.c
+++ b/gtk/gtkconstraintlayout.c
@@ -719,24 +719,18 @@
&min_size, &nat_size,
NULL, NULL);
- if (child_info->width_constraint[0] != NULL)
- {
- gtk_constraint_solver_remove_constraint (solver, child_info->width_constraint[0]);
- gtk_constraint_solver_remove_constraint (solver, child_info->width_constraint[1]);
- }
-
- if (child_info->height_constraint[0] != NULL)
- {
- gtk_constraint_solver_remove_constraint (solver, child_info->height_constraint[0]);
- gtk_constraint_solver_remove_constraint (solver, child_info->height_constraint[1]);
- }
-
switch (orientation)
{
case GTK_ORIENTATION_HORIZONTAL:
width_var = get_child_attribute (child_info, solver, child,
GTK_CONSTRAINT_ATTRIBUTE_WIDTH);
+ if (child_info->width_constraint[0] != NULL)
+ {
+ gtk_constraint_solver_remove_constraint (solver, child_info->width_constraint[0]);
+ gtk_constraint_solver_remove_constraint (solver, child_info->width_constraint[1]);
+ }
+
child_info->width_constraint[0] =
gtk_constraint_solver_add_constraint (solver,
width_var,
@@ -755,6 +749,12 @@
height_var = get_child_attribute (child_info, solver, child,
GTK_CONSTRAINT_ATTRIBUTE_HEIGHT);
+ if (child_info->height_constraint[0] != NULL)
+ {
+ gtk_constraint_solver_remove_constraint (solver, child_info->height_constraint[0]);
+ gtk_constraint_solver_remove_constraint (solver, child_info->height_constraint[1]);
+ }
+
child_info->height_constraint[0] =
gtk_constraint_solver_add_constraint (solver,
height_var,