texture-cache: Warn when loading sliced image fails
Sliced images are loaded into a group actor with one child actor per slice. In case loading the image fails, we currently quietly return the empty group actor, which makes diagnosing problems unnecessarily hard - just be a bit more verbose on failure. https://bugzilla.gnome.org/show_bug.cgi?id=774805
This commit is contained in:
parent
e5101eb407
commit
1de1fd44c5
@ -1088,6 +1088,7 @@ load_sliced_image (GTask *result,
|
|||||||
GdkPixbuf *pix;
|
GdkPixbuf *pix;
|
||||||
gint width, height, y, x;
|
gint width, height, y, x;
|
||||||
GdkPixbufLoader *loader;
|
GdkPixbufLoader *loader;
|
||||||
|
GError *error = NULL;
|
||||||
gchar *buffer = NULL;
|
gchar *buffer = NULL;
|
||||||
gsize length;
|
gsize length;
|
||||||
|
|
||||||
@ -1099,11 +1100,17 @@ load_sliced_image (GTask *result,
|
|||||||
loader = gdk_pixbuf_loader_new ();
|
loader = gdk_pixbuf_loader_new ();
|
||||||
g_signal_connect (loader, "size-prepared", G_CALLBACK (on_loader_size_prepared), data);
|
g_signal_connect (loader, "size-prepared", G_CALLBACK (on_loader_size_prepared), data);
|
||||||
|
|
||||||
if (!g_file_load_contents (data->gfile, NULL, &buffer, &length, NULL, NULL))
|
if (!g_file_load_contents (data->gfile, NULL, &buffer, &length, NULL, &error))
|
||||||
goto out;
|
{
|
||||||
|
g_warning ("Failed to open sliced image: %s", error->message);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!gdk_pixbuf_loader_write (loader, (const guchar *) buffer, length, NULL))
|
if (!gdk_pixbuf_loader_write (loader, (const guchar *) buffer, length, &error))
|
||||||
goto out;
|
{
|
||||||
|
g_warning ("Failed to load image: %s", error->message);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!gdk_pixbuf_loader_close (loader, NULL))
|
if (!gdk_pixbuf_loader_close (loader, NULL))
|
||||||
goto out;
|
goto out;
|
||||||
@ -1128,6 +1135,7 @@ load_sliced_image (GTask *result,
|
|||||||
* though the subpixbufs will hold a reference. */
|
* though the subpixbufs will hold a reference. */
|
||||||
g_object_unref (loader);
|
g_object_unref (loader);
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
|
g_clear_pointer (&error, g_error_free);
|
||||||
g_task_return_pointer (result, res, free_glist_unref_gobjects);
|
g_task_return_pointer (result, res, free_glist_unref_gobjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user