self-copy crashes for a stack overflow with svg12 backend
Submitted by Massimo
Assigned to Adrian Johnson @ajohnson
Description
Created attachment 112093 quick hack
The problem is that with a paginated surface (pdf, svg) _cairo_recording_surface_break_self_copy_loop flushes the internal recording surface, but not the parent which is the snapshot_of of the paint source pattern. When later detach_snapshots is invoked for the recording_surface it creates a paint command that uses the same recording surface as source and this results in a memory leak for the pdf backend and an infinite recursion for the svg12 backend.
The attached quick hack flushes the pattern->surface before adding the paint-command to the recording surface commands.
Reproduction step
(cd test && CAIRO_TEST_TARGET=pdf,svg12 .libs/cairo-test-suite -f self-copy)
Attachment 112093, "quick hack":
0001-quick-hack.patch