[cairo] Returning cached erroneous patterns

Baz brian.ewins at gmail.com
Thu Mar 22 11:12:40 PDT 2007


On 22/03/07, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Behdad's already fixed the primary case where we created a pattern
> and explicity put it into an error state. However, it also possible for
> a user to set an error status on a solid pattern, for example by using
> it as an argument where a gradient was expected. That has some rather
> unfortunate side-effects on a widely shared pattern...

Doesn't this mean it's possible for two threads to have already
fetched the pattern from the cache, before one of them manages to set
it to an error state? Even after this patch, I think you can do this
by calling cairo_pattern_add_color_stop_rgba on a solid pattern
fetched from the cache twice.

You can get similar behaviour in user applications by sharing
gradients then adding color stops. Both threads will see the colour
stops, and eventually both will see a pattern with an out of memory
status.

All of this comes from patterns being mutable, for adding color stops,
and setting user data. Should those operations should even be possible
on patterns with more than one reference?

(waits to be shot down)
-Baz


More information about the cairo mailing list