[gnome-shell/gnome-3-8] screenshot: Check for NULL window in screenshot_window()



commit 326c3732b8d6fd3415b34b3c44728101991d043e
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun May 19 12:26:49 2013 +0200

    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 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c
index c354612..4eca289 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]