[mutter] bind-constraint: Don't update preferred size if source contains actor



commit 5c5dcd58b53202003c661cf6c5cf27d2eb9161e5
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Fri Jun 19 12:45:18 2020 +0200

    bind-constraint: Don't update preferred size if source contains actor
    
    The ClutterBindConstraint will change the preferred size an actor
    reports so it returns the same size as the source actor in some cases.
    This behavior was introduced recently with 4f8e518d.
    
    This can lead to infinite loops in case the source actor is a parent of
    the actor the BindConstraint is attached to, that's because calling
    get_preferred_size() on the source will recursively call
    get_preferred_size() on the actor again.
    
    So to avoid those loops, check if the source is a parent of the actor
    we're attached to and don't update the preferred size in that case.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1282

 clutter/clutter/clutter-bind-constraint.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/clutter/clutter/clutter-bind-constraint.c b/clutter/clutter/clutter-bind-constraint.c
index 11eb5110ef..0f51600e07 100644
--- a/clutter/clutter/clutter-bind-constraint.c
+++ b/clutter/clutter/clutter-bind-constraint.c
@@ -165,6 +165,9 @@ clutter_bind_constraint_update_preferred_size (ClutterConstraint  *constraint,
         bind->coordinate == CLUTTER_BIND_ALL))
     return;
 
+  if (clutter_actor_contains (bind->source, actor))
+    return;
+
   switch (direction)
     {
     case CLUTTER_ORIENTATION_HORIZONTAL:


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