[cairo] Returning cached erroneous patterns

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 28 16:16:28 PDT 2007


Behdad Esfahbod (behdad at behdad.org) said: 
> On Thu, 2007-03-22 at 14:12 -0400, Baz wrote:
> > 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?
> 
> Ok, thanks for raising the issue.  The problem is that solid patterns
> are not immutable as we expected.  Giving away the same mutable object
> multiple times is definitely wrong.

Hmm, solid-patterns were not the only objects to be subjectable to this
unrecoverable error condition. A similar happenstance also occurs with
scaled fonts. :-(

Maaybe we need a proxy object to hold the user modifiable structures
struct _cairo_user_object {
    cairo_status_t status;
    unsigned int ref_count;
    cairo_user_data_array_t user_data;

    void *proxy; /* in this case the real _cairo_scaled_font */
}?

For the time being I'm using this patch to continue testing malloc
failures.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad-scaled-font.patch
Type: text/x-diff
Size: 1858 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070329/e816969f/bad-scaled-font.bin


More information about the cairo mailing list