From 73e7391e6e53b894f763f4715590d3be7e7ec243 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 18 Aug 2011 15:20:35 +0200 Subject: [PATCH] xcb: Handle SHM exhaustion via falling back When we couldn't get an image from the X11 server via SHM because we ran out shared memory, we should try again via a normal GetImage request. Fixes: xcb-huge-image-shm Signed-off-by: Uli Schlachter --- src/cairo-xcb-surface.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index c3df5ed52..ebea5ff7b 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -348,8 +348,13 @@ _get_image (cairo_xcb_surface_t *surface, if (use_shm) { image = _get_shm_image (surface, x, y, width, height); if (image) { - _cairo_xcb_connection_release (connection); - return image; + /* XXX This only wants to catch SHM exhaustion, + * not other allocation failures. */ + if (image->status != CAIRO_STATUS_NO_MEMORY) { + _cairo_xcb_connection_release (connection); + return image; + } + cairo_surface_destroy (image); } }