[gnome-shell/gnome-3-38] screenshot: Handle window screenshot failures gracefully
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-38] screenshot: Handle window screenshot failures gracefully
- Date: Mon, 19 Oct 2020 15:43:13 +0000 (UTC)
commit fef32dcf1bc06b30dde564ff770ac9ca0246dd4b
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Oct 18 16:01:05 2020 +0200
screenshot: Handle window screenshot failures gracefully
meta_window_actor_get_image() may return NULL. Instead of crashing,
catch that case and return a proper error.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3258
(cherry picked from commit d72da7d2465628150d83a9a152df2525691de1b0)
src/shell-screenshot.c | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c
index 3a1c92ccec..2505fc11da 100644
--- a/src/shell-screenshot.c
+++ b/src/shell-screenshot.c
@@ -292,6 +292,15 @@ grab_window_screenshot (ShellScreenshot *screenshot,
priv->image = meta_window_actor_get_image (META_WINDOW_ACTOR (window_actor),
NULL);
+
+ if (!priv->image)
+ {
+ g_task_report_new_error (screenshot, on_screenshot_written, result, NULL,
+ G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Capturing window failed");
+ return;
+ }
+
priv->datetime = g_date_time_new_now_local ();
if (flags & SHELL_SCREENSHOT_FLAG_INCLUDE_CURSOR)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]