From b6c972897b9d7cb898fb08363115e721a3ff758c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 3 Jul 2011 13:13:37 +0200 Subject: Xlib: Fix boilerplate to work with xlib-xcb Xlib boilerplate includes cairo-xlib-surface-private.h, so that it can cast the xlib cairo_surface_t to cairo_xlib_surface_t and then mess with some internals of that struct. However, xlib-xcb doesn't use that struct and thus this results in random memory corruption. "Luckily", all the fields that this messes with don't corrupt any fields in cairo_xlib_xcb_surface_t, but instead this writes past the end of the buffer that was returned from malloc. This commit just adds an #if to disable this code section since I have no idea what a proper fix would be. This means that the xlib-fallback backend doesn't actually test any fallbacks with xlib-xcb, however it never did so anyway. If you have any idea how to fix xlib-fallback with xlib-xcb, please speak up. Signed-off-by: Uli Schlachter --- boilerplate/cairo-boilerplate-xlib.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'boilerplate') diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c index 797fe972..6818cafd 100644 --- a/boilerplate/cairo-boilerplate-xlib.c +++ b/boilerplate/cairo-boilerplate-xlib.c @@ -412,6 +412,11 @@ _cairo_boilerplate_xlib_window_create_surface (const char *name, cairo_status_t cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface) { + /* The following stunt doesn't work with xlib-xcb because it doesn't use + * cairo_xlib_surface_t for its surfaces. Sadly, there is no sane + * alternative, so we can't disable render with xlib-xcb. + * FIXME: Find an alternative. */ +#if !CAIRO_HAS_XLIB_XCB_FUNCTIONS cairo_xlib_surface_t *surface = (cairo_xlib_surface_t*) abstract_surface; if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_XLIB) @@ -433,6 +438,7 @@ cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface #endif #if CAIRO_XLIB_SURFACE_HAS_BUGGY_REPEAT surface->buggy_repeat = TRUE; +#endif #endif return CAIRO_STATUS_SUCCESS; -- cgit v1.2.3