diff options
author | Uli Schlachter <psychon@znc.in> | 2011-08-18 15:20:35 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2011-08-18 16:34:44 +0200 |
commit | 73e7391e6e53b894f763f4715590d3be7e7ec243 (patch) | |
tree | 20bee94078e3e7747f7449f2df9ac62da21f7af0 /src | |
parent | aeba5acbad463db3a9eeb44e26a15979d1831472 (diff) |
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 <psychon@znc.in>
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-xcb-surface.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index c3df5ed5..ebea5ff7 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); } } |