From edbc9a20863fd226e377787f4e75c32d2e359399 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 28 Nov 2023 08:35:50 +0400 Subject: [PATCH] clutter/pick-stack: Add an allocation check to calculate_clear_area () We might pick an actor that needs relayout. I've seen this happen inside hiding / unmapping in particular. In this case, calculate_clear_area () will call clutter_actor_get_abs_allocation_vertices () which in turn will force a relayout. However, this is not what we want, because: 1. We don't want to run layout during picking. 2. If the actor needs an allocation, then the pick stack could not have used an up-to-date allocation, because it is not computed. Therefore this clear area would use a potentially completely different allocation than the one stored in the pick stack. Thankfully, clear area seems to be used as a cache/optimization, so let's just avoid computing it if the actor is not allocated. Part-of: --- clutter/clutter/clutter-pick-stack.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clutter/clutter/clutter-pick-stack.c b/clutter/clutter/clutter-pick-stack.c index 0e88a5087..625f798e2 100644 --- a/clutter/clutter/clutter-pick-stack.c +++ b/clutter/clutter/clutter-pick-stack.c @@ -462,6 +462,13 @@ calculate_clear_area (ClutterPickStack *pick_stack, MtkRectangle rect; int i; + if (!clutter_actor_has_allocation (pick_rec->actor)) + { + if (clear_area) + *clear_area = NULL; + return; + } + clutter_actor_get_abs_allocation_vertices (pick_rec->actor, (graphene_point3d_t *) &verts); if (!get_verts_rectangle (verts, &rect))