mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
background-image: Use autoptrs for errors when loading image
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1979>
This commit is contained in:
parent
41d1a8407e
commit
04994ebddf
@ -155,8 +155,8 @@ file_loaded (GObject *source_object,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaBackgroundImage *image = META_BACKGROUND_IMAGE (source_object);
|
MetaBackgroundImage *image = META_BACKGROUND_IMAGE (source_object);
|
||||||
GError *error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
GError *catch_error = NULL;
|
g_autoptr (GError) local_error = NULL;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
CoglTexture *texture;
|
CoglTexture *texture;
|
||||||
GdkPixbuf *pixbuf, *rotated;
|
GdkPixbuf *pixbuf, *rotated;
|
||||||
@ -172,7 +172,6 @@ file_loaded (GObject *source_object,
|
|||||||
char *uri = g_file_get_uri (image->file);
|
char *uri = g_file_get_uri (image->file);
|
||||||
g_warning ("Failed to load background '%s': %s",
|
g_warning ("Failed to load background '%s': %s",
|
||||||
uri, error->message);
|
uri, error->message);
|
||||||
g_clear_error (&error);
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -198,10 +197,9 @@ file_loaded (GObject *source_object,
|
|||||||
has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
|
has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
|
||||||
row_stride,
|
row_stride,
|
||||||
pixels, 0,
|
pixels, 0,
|
||||||
&catch_error))
|
&local_error))
|
||||||
{
|
{
|
||||||
g_warning ("Failed to create texture for background");
|
g_warning ("Failed to create texture for background");
|
||||||
g_error_free (catch_error);
|
|
||||||
cogl_object_unref (texture);
|
cogl_object_unref (texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user