summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-surface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-11-18 10:01:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-11-18 10:01:55 +0000
commit2283ab969801ef6c610ad20a58693a5b55382c8a (patch)
tree8f200394d57f0ffd814e9a402c01e93282cce46b /src/cairo-xcb-surface.c
parentc8dca5dad678258ee1bf7d60f5a6f766060c7fce (diff)
downloadcairo-2283ab969801ef6c610ad20a58693a5b55382c8a.tar.gz
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>
Diffstat (limited to 'src/cairo-xcb-surface.c')
-rw-r--r--src/cairo-xcb-surface.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 75a1f87a8..cf649491d 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -240,8 +240,12 @@ _cairo_xcb_surface_create_shm_image (cairo_xcb_connection_t *connection,
stride * height,
might_reuse,
&shm_info);
- if (unlikely (status))
+ if (unlikely (status)) {
+ if (status == CAIRO_INT_STATUS_UNUSPPORTED)
+ return NULL;
+
return _cairo_surface_create_in_error (status);
+ }
image = _cairo_image_surface_create_with_pixman_format (shm_info->mem,
pixman_format,
@@ -354,9 +358,7 @@ _get_image (cairo_xcb_surface_t *surface,
if (use_shm) {
image = _get_shm_image (surface, x, y, width, height);
if (image) {
- /* XXX This only wants to catch SHM exhaustion,
- * not other allocation failures. */
- if (image->status != CAIRO_STATUS_NO_MEMORY) {
+ if (image->status) {
_cairo_xcb_connection_release (connection);
return image;
}