742.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 10a9798f79adc379fd8e425254a6b7fe7fa759ff Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
  3. Date: Mon, 23 Sep 2019 13:46:05 +0200
  4. Subject: [PATCH] shell-util: Handle NULL from meta_window_get_image()
  5. Until commit 506b75fc7f3 we got away with not handling a NULL return
  6. value, as cairo_surface_destroy() deals with a NULL surface; the same
  7. isn't true for get_width/get_height, so guard to code in question to
  8. prevent a crash.
  9. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1678
  10. ---
  11. src/shell-util.c | 5 ++++-
  12. 1 file changed, 4 insertions(+), 1 deletion(-)
  13. diff --git a/src/shell-util.c b/src/shell-util.c
  14. index e94f3c364d..c22dd1c6e5 100644
  15. --- a/src/shell-util.c
  16. +++ b/src/shell-util.c
  17. @@ -419,7 +419,7 @@ canvas_draw_cb (ClutterContent *content,
  18. * @window_actor: a #MetaWindowActor
  19. * @window_rect: a #MetaRectangle
  20. *
  21. - * Returns: (transfer full): a new #ClutterContent
  22. + * Returns: (transfer full) (nullable): a new #ClutterContent
  23. */
  24. ClutterContent *
  25. shell_util_get_content_for_window_actor (MetaWindowActor *window_actor,
  26. @@ -439,6 +439,9 @@ shell_util_get_content_for_window_actor (MetaWindowActor *window_actor,
  27. surface = meta_window_actor_get_image (window_actor, &clip);
  28. + if (!surface)
  29. + return NULL;
  30. +
  31. content = clutter_canvas_new ();
  32. clutter_canvas_set_size (CLUTTER_CANVAS (content),
  33. cairo_image_surface_get_width (surface),
  34. --
  35. 2.22.0