gfx/cairo/xlib-flush-glyphs.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c
     2 index f0de3c7..e24c962 100644
     3 --- a/gfx/cairo/cairo/src/cairo-xlib-surface.c
     4 +++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c
     5 @@ -50,35 +50,36 @@
     6  #include "cairo-xlib-private.h"
     7  #include "cairo-xlib-surface-private.h"
     8  #include "cairo-clip-private.h"
     9  #include "cairo-error-private.h"
    10  #include "cairo-scaled-font-private.h"
    11  #include "cairo-surface-snapshot-private.h"
    12  #include "cairo-surface-subsurface-private.h"
    13  #include "cairo-region-private.h"
    14 +#include "cairo-xlib-xrender-private.h"
    16  #include <X11/Xutil.h> /* for XDestroyImage */
    17 +#include <X11/Xlibint.h> /* for access to XDisplay's innards */
    19  #define XLIB_COORD_MAX 32767
    21  #define DEBUG 0
    23  #if DEBUG
    24  #define UNSUPPORTED(reason) \
    25      fprintf (stderr, \
    26  	     "cairo-xlib: hit unsupported operation %s(), line %d: %s\n", \
    27  	     __FUNCTION__, __LINE__, reason), \
    28      CAIRO_INT_STATUS_UNSUPPORTED
    29  #else
    30  #define UNSUPPORTED(reason) CAIRO_INT_STATUS_UNSUPPORTED
    31  #endif
    33  #if DEBUG
    34 -#include <X11/Xlibint.h>
    35  static void CAIRO_PRINTF_FORMAT (2, 3)
    36  _x_bread_crumb (Display *dpy,
    37  		const char *fmt,
    38  		...)
    39  {
    40      xReq *req;
    41      char buf[2048];
    42      unsigned int len, len_dwords;
    43 @@ -4313,16 +4314,23 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display,
    44  	}
    45  	break;
    46      default:
    47  	ASSERT_NOT_REACHED;
    48  	break;
    49      }
    50      /* XXX assume X server wants pixman padding. Xft assumes this as well */
    52 +    struct _XDisplay *dpy = (struct _XDisplay *) display->display;
    53 +    int req_length = sz_xRenderAddGlyphsReq + 4;
    54 +    if (req_length & 3)
    55 +	req_length += 4 - (req_length & 3);
    56 +    if (dpy->bufptr + req_length > dpy->bufmax)
    57 +	XFlush (display->display);
    58 +
    59      XRenderAddGlyphs (display->display, glyphset_info->glyphset,
    60  		      &glyph_index, &glyph_info, 1,
    61  		      (char *) data,
    62  		      glyph_surface->stride * glyph_surface->height);
    64      if (data != glyph_surface->data)
    65  	free (data);

mercurial