[gnome-control-center] background: Fix error checking in on_screenshot_finished()



commit 681aed6f9c6646a868b0b70ffe8b8dbecf83290b
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jan 30 15:35:15 2013 +0100

    background: Fix error checking in on_screenshot_finished()
    
    This could create crashers when no errors were detected, but
    either the D-Bus call or loading the pixbuf return NULL.
    
    Conflicts:
    	panels/background/cc-background-panel.c

 panels/background/cc-background-panel.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index e67c1c0..de4f65c 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -248,15 +248,16 @@ on_screenshot_finished (GObject *source,
   GdkPixbuf *pixbuf;
   cairo_surface_t *surface;
   cairo_t *cr;
+  GVariant *result;
   int width;
   int height;
 
   error = NULL;
-  g_dbus_connection_call_finish (G_DBUS_CONNECTION (source),
-                                 res,
-                                 &error);
+  result = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source),
+                                          res,
+                                          &error);
 
-  if (error != NULL) {
+  if (result == NULL) {
     if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
       g_error_free (error);
       return;
@@ -267,9 +268,10 @@ on_screenshot_finished (GObject *source,
     /* fallback? */
     goto out;
   }
+  g_variant_unref (result);
 
   pixbuf = gdk_pixbuf_new_from_file (panel->priv->screenshot_path, &error);
-  if (error != NULL)
+  if (pixbuf == NULL)
     {
       g_debug ("Unable to use GNOME Shell's builtin screenshot interface: %s",
                error->message);



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