From c68ccbf263061e2df945ee344098b2d46459414b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 19 May 2013 12:26:49 +0200 Subject: [PATCH] screenshot: Check for NULL window in screenshot_window() screenshot_window() currently assumes a focus window, which will result in a crash if that's not the case. https://bugzilla.gnome.org/show_bug.cgi?id=700625 --- src/shell-screenshot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c index c354612c5..4eca28983 100644 --- a/src/shell-screenshot.c +++ b/src/shell-screenshot.c @@ -492,6 +492,17 @@ shell_screenshot_screenshot_window (ShellScreenshot *screenshot, screenshot_data->filename = g_strdup (filename); screenshot_data->callback = callback; + if (!window) + { + screenshot_data->filename_used = g_strdup (""); + result = g_simple_async_result_new (NULL, on_screenshot_written, (gpointer)screenshot_data, shell_screenshot_screenshot_window); + g_simple_async_result_set_op_res_gboolean (result, FALSE); + g_simple_async_result_complete (result); + g_object_unref (result); + + return; + } + window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); clutter_actor_get_position (window_actor, &actor_x, &actor_y);