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.
_cairo_pattern_fini depends on the pattern being correctly initialised,
for example when calling _cairo_user_data_array_fini(), so we need to
initialize the whole pattern and not just set the type to SOLID when
creating a pattern for a surface in error.
The image surface that _cairo_quartz_surface_acquire_source_image creates never
seems to be released, probably because there is no release_source_image callback
in the quartz code.
The attached patch fixes that problem, at least insofar as the image surface
itself is no longer leaking. I'm not sure whether any other cleanup needs to
happen here.
-Boris
Previously if the backend finish() function returned an error status,
surface->finished was not set true. This would result in the backend
finish() function being called twice which in the case of the PostScript
backend caused a seg fault.
_cairo_pdf_surface_emit_pattern_stops() tried to set the last element
to have an offset of exactly 1.0, but missed and set the next element
after the end of the array.
cairo_surface_create_similar() does not return NULL as was being checked
for, but the nil surface on error. Also ensure that the returned surface
is destroyed if we encounter an error whilst compositing.
Growing the arrays may successfully allocate the indirect pointer, but
fail whilst allocating the actual array - so always call
_cairo_array_fini after _cairo_array_grow_by().
If we fail to create the sub font destroy the local reference to the
parent font and if we fail to insert the sub font into the hash table,
destroy the newly create sub font.
Small window of opportunity for the unscaled font to be destroyed and
removed from the hash table before
_cairo_ft_unscaled_font_create_for_pattern() takes a reference on behalf
of its cairo. Close the window by taking the reference with the font
map lock held.
The status return from _cairo_xlib_screen_put_gc() indicates the failure
to queue a job to free an old GC - the current GC is always transferred
away from the caller, so always nullify it in the surface.
Return the nil object if we encounter any error whilst trying to
generate the path.
Also special case the NO_MEMORY error object to return the nil object.
After consuming the GC we need to unset the clip reset flag, so that
if we try and get a new GC without first putting a fresh one we do not
try to call XSetClipMask on a NULL GC.
(Fixes http://bugs.freedesktop.org/show_bug.cgi?id=10921)
By dropping the top frame from suppression, the XrmGetFileDatabase
suppressions will also match XrmGetStringDatabase leaks which are
starting to occur.
_cairo_truetype_font_create() failed to update the status before
returning after detecting an allocation failure, leaving its callers
none the wishing - and eventually triggering a segmentation fault when
the font was used in anger.
Before attempting to access the cairo_meta_surface_t specific members,
we need to ensure that _cairo_meta_surface_replay() has received a true
meta surface rather than an error surface (e.g. _cairo_surface_nil).
Sun never released a version of Solaris with Xorg with the buggy repeat
problem. This patch was only needed for development versions of Solaris
Nevada (roughly builds 25-30). The latest S10U release and Nevada releases
have a fixed Xorg. So no users should ever encounter this bug.
We need to remove this test because Xsun has the same VendorString and a lower
VendorRelease number so it falsely triggers buggy_repeat to be turned on.
They just added Xrender support recently to Xsun, so this wasn't an issue
before recently.
cairo_scaled_font_create() returns a nil object on failure whereas a few
callers were checking for NULL.
Secondly review the public entry points for cairo_scaled_font_*() to
ensure that all check that they will not attempt to overwrite the
read-only nil object.