Do not skip CoglError parameters
While CoglError is a define to GError, it doesn't follow the convention of ignoring errors when NULL is passed, but rather treats the error as fatal :-( That's clearly unwanted for a compositor, so make sure to always pass an error parameter where a runtime error is possible https://bugzilla.gnome.org/show_bug.cgi?id=765061
This commit is contained in:
@@ -461,14 +461,24 @@ pixbuf_to_cogl_texture (GdkPixbuf *pixbuf)
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
||||
CoglError *error = NULL;
|
||||
CoglTexture2D *texture;
|
||||
|
||||
return COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
gdk_pixbuf_get_has_alpha (pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
|
||||
gdk_pixbuf_get_rowstride (pixbuf),
|
||||
gdk_pixbuf_get_pixels (pixbuf),
|
||||
NULL));
|
||||
texture = cogl_texture_2d_new_from_data (ctx,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
gdk_pixbuf_get_has_alpha (pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
|
||||
gdk_pixbuf_get_rowstride (pixbuf),
|
||||
gdk_pixbuf_get_pixels (pixbuf),
|
||||
&error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
g_warning ("Failed to allocate texture: %s", error->message);
|
||||
cogl_error_free (error);
|
||||
}
|
||||
|
||||
return texture ? COGL_TEXTURE (texture) : NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
@@ -632,6 +642,8 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
|
||||
(cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32 ||
|
||||
cairo_image_surface_get_format (surface) == CAIRO_FORMAT_RGB24))
|
||||
{
|
||||
CoglError *error = NULL;
|
||||
|
||||
texdata = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx,
|
||||
cairo_image_surface_get_width (surface),
|
||||
cairo_image_surface_get_height (surface),
|
||||
@@ -639,13 +651,18 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
|
||||
COGL_PIXEL_FORMAT_BGRA_8888 : COGL_PIXEL_FORMAT_BGR_888,
|
||||
cairo_image_surface_get_stride (surface),
|
||||
cairo_image_surface_get_data (surface),
|
||||
NULL));
|
||||
&error));
|
||||
|
||||
if (texdata)
|
||||
{
|
||||
clutter_texture_set_cogl_texture (bind->texture, texdata);
|
||||
cogl_object_unref (texdata);
|
||||
}
|
||||
else if (error)
|
||||
{
|
||||
g_warning ("Failed to allocate texture: %s", error->message);
|
||||
cogl_error_free (error);
|
||||
}
|
||||
|
||||
clutter_actor_set_opacity (CLUTTER_ACTOR (bind->texture), 255);
|
||||
}
|
||||
|
Reference in New Issue
Block a user