summaryrefslogtreecommitdiff
path: root/gtk/gtkconstraintlayout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-06-27 04:12:59 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-06-27 04:12:59 +0000
commit36bea407fdaf10406cad438b5c178ed7b7125331 (patch)
tree84ef478393724b26b923f605862f1289e7a35f78 /gtk/gtkconstraintlayout.c
parent3dc50c1e628c8000fbf54c2cad53ade6c904e087 (diff)
downloadgtk+-constraint-grid.tar.gz
measure: don't leave dangling referencesconstraint-grid
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.
Diffstat (limited to 'gtk/gtkconstraintlayout.c')
-rw-r--r--gtk/gtkconstraintlayout.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c
index 14b8fa6e80..b37f51c8a0 100644
--- a/gtk/gtkconstraintlayout.c
+++ b/gtk/gtkconstraintlayout.c
@@ -719,24 +719,18 @@ gtk_constraint_layout_measure (GtkLayoutManager *manager,
&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 @@ gtk_constraint_layout_measure (GtkLayoutManager *manager,
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,