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
This commit is contained in:
Florian Müllner 2013-05-19 12:26:49 +02:00
parent 5dd020f2e2
commit 326c3732b8

View File

@ -492,6 +492,17 @@ shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
screenshot_data->filename = g_strdup (filename); screenshot_data->filename = g_strdup (filename);
screenshot_data->callback = callback; 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)); window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
clutter_actor_get_position (window_actor, &actor_x, &actor_y); clutter_actor_get_position (window_actor, &actor_x, &actor_y);