From 36bea407fdaf10406cad438b5c178ed7b7125331 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 27 Jun 2019 04:12:59 +0000 Subject: [PATCH] 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. --- gtk/gtkconstraintlayout.c | 24 ++++++++++++------------ 1 file 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,