[cairo] Bug in the svg backend

Andrea Canciani ranma42 at gmail.com
Sat Jun 18 04:42:46 PDT 2011

On Mon, Jun 13, 2011 at 11:47 AM, Maximilian Heinzler <maxi at heinzler.de> wrote:
> I found a bug in the svg backend.
> The problem is the following:
> If you use a surface pattern in two different svg documents it is possible
> that the source is not written to the second file. This patch should fix
> this completely.

I read your patch and it seems quite reasonable (under the usual assumption
that the surface serial will never wrap), but I think it might be a
good idea to explain
why you take the seral of the paginated surface target instead of the
serial of the
paginated surface (is it linked with the behavior upon show_page()?).

There should be some minor adjustments regarding coding style, in particular
the whitespace before '(' is missing, document_id_data is declared after some
code and the indentation of _cairo_svg_document_id_as_pointer is nonstandard.

Long-term wish:
I don't like using user_data to track this kind of information, because it is
error-prone, either in incorrectly reporting matches or in risking
reference loops.
I prefer the approach used in cairo-pdf, i.e. the destination surface keeps
references to the surfaces that have been emitted in it.
If nobody has objections against this idea, I'll work on a patch to replace
the user-data "trick" with the pdf-like approach.


> Note:
> There is a test file attached which shows the bug, but because it’s a
> problem of pointer addresses it may work on some machines without any
> mistake.
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

More information about the cairo mailing list