It is possible for the resources that we defer freeing to be already
destroyed and trigger an XError whilst processing the work queue. For
example, the application renders to a Window and then destroys the
Drawable before proceeding with more rendering. This will trigger an
invalid Picture from RenderFreePicture whilst attempting to free the
resources.
By ignoring the possibility that the application could allocate a fresh
resource with the same ID, we can simply hide the XErrors...
Fixes: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243811
Call XSync before ignoring errors from XGetImage to avoid hiding
unassociated errors. Similarly, call XSync before reinstalling the old
error handler to ensure no errors creep out of the ignored section.
When an xlib surface is used as the source of a draw operation this
will cause the contents of child windows to be included in the source
data. The semantics of drawing to xlib surfaces are unchanged (ie:
draws are still clipped by child windows overlapping the destination
window).
[quartz] move glyph array declarations
Move declarations causing a warning. A separate patch from
the other warning cleanups because it moves where the allocation
happens.
cairo-gstate applies the ctm to the coordinates used in paths,
but not to the line width. In quartz this ends up drawing unscaled
lines. This is a minimal fix - it undoes the scaling applied to the
points and then draws the path scaled correctly.
Implement extend-none for surface patterns, by using a single
DrawImage where possible. There is some code duplication in this
patch, to make it easier to edit this patch series without conflicts.
A patch to remove duplicate code will be required later..
Attempt to allocate the edges during tessellate_polygon() from the stack,
if the polygon size is sufficiently small and amalgamate the separate
allocations for the list of events and their sorted index into a single
block.
Behdad Esfahbod noted that in ff5af0f540 I had introduce new error
paths without the appropriate _cairo_error(). So review cairo-ft-font
to ensure that _cairo_error() is called at the start of every error path,
as close to the originating error as possible.
Set the cairo_t status to be the surface->status when the context is
created, and special case the NO_MEMORY status in order to avoid a
redundant allocation.
After using the public API to access the scaled font, which only sets
the status field in the font, check the scaled font status. This will
then correctly propagate errors during glyph loading to the context.
Add an initial guard in _cairo_gstate_ensure_scaled_font() and
_cairo_gstate_ensure_font_face() to check that there is no prior
error status on the objects.
After introducing a work queue for deferred destruction of X resource
my firefox crashes over and over again because XRenderFreeGlyphs is trying
to free a non-exist glyph (already freed). The problematic call sequence is
something like below:
XRenderAddGlyphs (20990204, 20069)
XRenderAddGlyphs (20990204, 20069)
XRenderFreeGlyphs (20990204, 20069)
XRenderFreeGlyphs (20990204, 20069)
You can see the two add/free glyphs is interlaced. And obviously, we'll crash
at the last one. To fix this bug, we must be ensure here's no pending work
to free the glyph that we want to sent.
I don't know how I managed to get glyph measurement so badly wrong
before, but tracing paths was not necessary, and 6x slower. The fix
switches to using ATSGlyphGetScreenMetrics for all metrics, and remove
the old measuring code.