[cairo] [cairo-commit] test/surface-source.c

Chris Wilson chris at chris-wilson.co.uk
Mon Sep 29 14:32:43 PDT 2008

On Mon, 2008-09-29 at 14:11 -0700, Carl Worth wrote:
> And idiom like:
> 	cairo_set_source_surface (cr, surface);
> 	cairo_surface_destroy (surface);
> is fairly common in our documentation, (handing an object to cairo for
> it to reference, and dropping the application's reference). Why should
> that be illegal here?

The problem is the manner in which I constructed the surface for this
test tightly couples the Display to that surface - i.e. the user_data
destroy notifier calls XCloseDisplay. At the time, it was a convenient
method of hooking into the test scope, but it is a bug waiting to, and
did, happen. Given that the boilerplate has advanced somewhat since the
inception of those tests, I think may now be viable to use the
boilerplate to generate both the source and destination surfaces - and
in the process reduce the multiple tests into one.
Chris Wilson

More information about the cairo mailing list