1
0
Fork 0

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 (i.e. any CoglError
that is not a malformed blend string).

https://bugzilla.gnome.org/show_bug.cgi?id=765058
This commit is contained in:
Florian Müllner 2016-04-14 15:30:31 +02:00
parent bdc72dd9d7
commit 8842bdfb11
8 changed files with 63 additions and 9 deletions

View file

@ -198,6 +198,7 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
guint8 *cursor_data;
gboolean free_cursor_data;
CoglContext *ctx;
CoglError *error = NULL;
if (tracker->xfixes_cursor)
return;
@ -239,11 +240,17 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
CLUTTER_CAIRO_FORMAT_ARGB32,
cursor_image->width * 4, /* stride */
cursor_data,
NULL);
&error);
if (free_cursor_data)
g_free (cursor_data);
if (error != NULL)
{
meta_warning ("Failed to allocate cursor sprite texture: %s\n", error->message);
cogl_error_free (error);
}
if (sprite != NULL)
{
MetaCursorSprite *cursor_sprite = meta_cursor_sprite_new ();

View file

@ -136,6 +136,7 @@ meta_cursor_sprite_load_from_xcursor_image (MetaCursorSprite *self,
ClutterBackend *clutter_backend;
CoglContext *cogl_context;
CoglTexture *texture;
CoglError *error = NULL;
g_assert (self->texture == NULL);
@ -156,7 +157,14 @@ meta_cursor_sprite_load_from_xcursor_image (MetaCursorSprite *self,
cogl_format,
rowstride,
(uint8_t *) xc_image->pixels,
NULL);
&error);
if (error)
{
meta_warning ("Failed to allocate cursor texture: %s\n", error->message);
cogl_error_free (error);
}
meta_cursor_sprite_set_texture (self, texture,
xc_image->xhot, xc_image->yhot);

View file

@ -152,6 +152,7 @@ file_loaded (GObject *source_object,
{
MetaBackgroundImage *image = META_BACKGROUND_IMAGE (source_object);
GError *error = NULL;
CoglError *catch_error = NULL;
GTask *task;
CoglTexture *texture;
GdkPixbuf *pixbuf;
@ -186,9 +187,10 @@ file_loaded (GObject *source_object,
has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
row_stride,
pixels, 0,
NULL))
&catch_error))
{
g_warning ("Failed to create texture for background");
cogl_error_free (catch_error);
cogl_object_unref (texture);
}

View file

@ -17,6 +17,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <meta/util.h>
#include <meta/meta-background.h>
#include <meta/meta-background-image.h>
#include "meta-background-private.h"
@ -542,6 +543,7 @@ ensure_color_texture (MetaBackground *self)
{
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
CoglError *error = NULL;
uint8_t pixels[6];
int width, height;
@ -582,7 +584,13 @@ ensure_color_texture (MetaBackground *self)
COGL_PIXEL_FORMAT_RGB_888,
width * 3,
pixels,
NULL));
&error));
if (error != NULL)
{
meta_warning ("Failed to allocate color texture: %s\n", error->message);
cogl_error_free (error);
}
}
}

View file

@ -27,6 +27,7 @@
#include <string.h>
#include <meta/meta-shadow-factory.h>
#include <meta/util.h>
#include "cogl-utils.h"
#include "region-utils.h"
@ -707,6 +708,7 @@ make_shadow (MetaShadow *shadow,
{
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
CoglError *error = NULL;
int d = get_box_filter_size (shadow->key.radius);
int spread = get_shadow_spread (shadow->key.radius);
cairo_rectangle_int_t extents;
@ -804,7 +806,13 @@ make_shadow (MetaShadow *shadow,
(buffer +
(y_offset - shadow->outer_border_top) * buffer_width +
(x_offset - shadow->outer_border_left)),
NULL));
&error));
if (error)
{
meta_warning ("Failed to allocate shadow texture: %s\n", error->message);
cogl_error_free (error);
}
cairo_region_destroy (row_convolve_region);
cairo_region_destroy (column_convolve_region);

View file

@ -113,14 +113,20 @@ set_pixmap (MetaSurfaceActorX11 *self,
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
CoglError *error = NULL;
CoglTexture *texture;
g_assert (priv->pixmap == None);
priv->pixmap = pixmap;
texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE, NULL));
texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE, &error));
if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
if (error != NULL)
{
g_warning ("Failed to allocate stex texture: %s", error->message);
cogl_error_free (error);
}
else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
g_warning ("NOTE: Not using GLX TFP!\n");
priv->texture = texture;

View file

@ -1752,9 +1752,17 @@ build_and_scan_frame_mask (MetaWindowActor *self,
}
else
{
CoglError *error = NULL;
mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
COGL_PIXEL_FORMAT_A_8,
stride, mask_data, NULL));
stride, mask_data, &error));
if (error)
{
g_warning ("Failed to allocate mask texture: %s", error->message);
cogl_error_free (error);
}
}
meta_shaped_texture_set_mask_texture (stex, mask_texture);

View file

@ -134,12 +134,19 @@ meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
for (i = 0; i < n_rectangles; i++)
{
CoglError *error = NULL;
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (region, i, &rect);
cogl_wayland_texture_set_region_from_shm_buffer (buffer->texture,
rect.x, rect.y, rect.width, rect.height,
shm_buffer,
rect.x, rect.y, 0, NULL);
rect.x, rect.y, 0, &error);
if (error)
{
meta_warning ("Failed to set texture region: %s\n", error->message);
cogl_error_free (error);
}
}
wl_shm_buffer_end_access (shm_buffer);