mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 11:47:59 +02:00
xcb: Handle SHM exhaustion gracefully
Avoid the assertion failure of creating an error surface for an internal status by handling the expected UNSUPPORTED condition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
c8dca5dad6
commit
2283ab9698
1 changed files with 6 additions and 4 deletions
|
|
@ -240,8 +240,12 @@ _cairo_xcb_surface_create_shm_image (cairo_xcb_connection_t *connection,
|
||||||
stride * height,
|
stride * height,
|
||||||
might_reuse,
|
might_reuse,
|
||||||
&shm_info);
|
&shm_info);
|
||||||
if (unlikely (status))
|
if (unlikely (status)) {
|
||||||
|
if (status == CAIRO_INT_STATUS_UNUSPPORTED)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return _cairo_surface_create_in_error (status);
|
return _cairo_surface_create_in_error (status);
|
||||||
|
}
|
||||||
|
|
||||||
image = _cairo_image_surface_create_with_pixman_format (shm_info->mem,
|
image = _cairo_image_surface_create_with_pixman_format (shm_info->mem,
|
||||||
pixman_format,
|
pixman_format,
|
||||||
|
|
@ -354,9 +358,7 @@ _get_image (cairo_xcb_surface_t *surface,
|
||||||
if (use_shm) {
|
if (use_shm) {
|
||||||
image = _get_shm_image (surface, x, y, width, height);
|
image = _get_shm_image (surface, x, y, width, height);
|
||||||
if (image) {
|
if (image) {
|
||||||
/* XXX This only wants to catch SHM exhaustion,
|
if (image->status) {
|
||||||
* not other allocation failures. */
|
|
||||||
if (image->status != CAIRO_STATUS_NO_MEMORY) {
|
|
||||||
_cairo_xcb_connection_release (connection);
|
_cairo_xcb_connection_release (connection);
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue