[gnome-shell/issue-36: 2/2] shadow: Don't attempt to create a shadow for unallocated actors



commit 735ce62e8b63ac2ec6950eff114c655f4f1c1e84
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Fri Feb 9 11:50:32 2018 +0000

    shadow: Don't attempt to create a shadow for unallocated actors
    
    Calling clutter_actor_get_allocation_box() can potentially cause a
    re-layout, which in _st_create_shadow_pipeline_from_actor() would
    mean invalidating the shadow_spec passed as a parameter, which
    could crash the shell later on since the value for shadow_spec->blur
    passed from _st_create_shadow_pipeline() to blur_pixels() would
    not be a valid one.
    
    Thus, whether the ClutterActor has an allocation before calling
    clutter_actor_get_allocation_box(), and early return if needed.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/36
    
    Closes: #36

 src/st/st-private.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index be78833e7..ff4bb3070 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -417,6 +417,11 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
   ClutterActorBox box;
   float width, height;
 
+  /* Calling clutter_actor_get_allocation_box() can provoke a re-layout, which
+   * would invalidate the shadow_spec, so check this and early return if needed. */
+  if (!clutter_actor_has_allocation(actor))
+    return NULL;
+
   clutter_actor_get_allocation_box (actor, &box);
   clutter_actor_box_get_size (&box, &width, &height);
 


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