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
This commit is contained in:
parent
6273654376
commit
d72da7d246
@ -295,6 +295,15 @@ grab_window_screenshot (ShellScreenshot *screenshot,
|
|||||||
|
|
||||||
priv->image = meta_window_actor_get_image (META_WINDOW_ACTOR (window_actor),
|
priv->image = meta_window_actor_get_image (META_WINDOW_ACTOR (window_actor),
|
||||||
NULL);
|
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 ();
|
priv->datetime = g_date_time_new_now_local ();
|
||||||
|
|
||||||
if (flags & SHELL_SCREENSHOT_FLAG_INCLUDE_CURSOR)
|
if (flags & SHELL_SCREENSHOT_FLAG_INCLUDE_CURSOR)
|
||||||
|
Loading…
Reference in New Issue
Block a user