[gtk/constraint-grid] measure: don't leave dangling references
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/constraint-grid] measure: don't leave dangling references
- Date: Thu, 27 Jun 2019 04:34:12 +0000 (UTC)
commit 36bea407fdaf10406cad438b5c178ed7b7125331
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jun 27 04:12:59 2019 +0000
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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]