[mutter] background-image: Use autoptrs for errors when loading image



commit 04994ebddf4e066512c41999b47b67c6b2f06d86
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Aug 31 09:47:24 2021 +0200

    background-image: Use autoptrs for errors when loading image
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1979>

 src/compositor/meta-background-image.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/compositor/meta-background-image.c b/src/compositor/meta-background-image.c
index ed9425bb36..c23eef9099 100644
--- a/src/compositor/meta-background-image.c
+++ b/src/compositor/meta-background-image.c
@@ -155,8 +155,8 @@ file_loaded (GObject      *source_object,
              gpointer      user_data)
 {
   MetaBackgroundImage *image = META_BACKGROUND_IMAGE (source_object);
-  GError *error = NULL;
-  GError *catch_error = NULL;
+  g_autoptr (GError) error = NULL;
+  g_autoptr (GError) local_error = NULL;
   GTask *task;
   CoglTexture *texture;
   GdkPixbuf *pixbuf, *rotated;
@@ -172,7 +172,6 @@ file_loaded (GObject      *source_object,
       char *uri = g_file_get_uri (image->file);
       g_warning ("Failed to load background '%s': %s",
                  uri, error->message);
-      g_clear_error (&error);
       g_free (uri);
       goto out;
     }
@@ -198,10 +197,9 @@ file_loaded (GObject      *source_object,
                               has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
                               row_stride,
                               pixels, 0,
-                              &catch_error))
+                              &local_error))
     {
       g_warning ("Failed to create texture for background");
-      g_error_free (catch_error);
       cogl_object_unref (texture);
     }
 


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