[mutter] window-actor: Add a missing NULL-check



commit 317ce05a27afe309b34aada2664dd6e23f0d9980
Author: Robert Mader <robert mader posteo de>
Date:   Mon Oct 14 17:45:14 2019 +0200

    window-actor: Add a missing NULL-check
    
    We shouldn't crash on a NULL-clip.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/856

 src/compositor/meta-window-actor.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index db9ccec62..fd99844e8 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -2183,21 +2183,25 @@ meta_window_actor_get_image (MetaWindowActor *self,
   if (clutter_actor_get_n_children (actor) == 1)
     {
       MetaShapedTexture *stex;
-      MetaRectangle surface_clip;
-      int geometry_scale;
+      MetaRectangle *surface_clip = NULL;
 
-      geometry_scale =
-        meta_window_actor_get_geometry_scale (self);
+      if (clip)
+        {
 
-      surface_clip = (MetaRectangle) {
-        .x = clip->x / geometry_scale,
-        .y = clip->y / geometry_scale,
-        .width = clip->width / geometry_scale,
-        .height = clip->height / geometry_scale,
-      };
+          int geometry_scale;
+
+          geometry_scale =
+            meta_window_actor_get_geometry_scale (self);
+
+          surface_clip = g_alloca (sizeof (MetaRectangle));
+          surface_clip->x = clip->x / geometry_scale,
+          surface_clip->y = clip->y / geometry_scale;
+          surface_clip->width = clip->width / geometry_scale;
+          surface_clip->height = clip->height / geometry_scale;
+        }
 
       stex = meta_surface_actor_get_texture (priv->surface);
-      return meta_shaped_texture_get_image (stex, &surface_clip);
+      return meta_shaped_texture_get_image (stex, surface_clip);
     }
 
   clutter_actor_get_size (actor, &width, &height);


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