cairo: Avoid using cairo_t for a destroyed cairo_surface_t.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 26 Dec 2020 05:54:48 +0000 (21:54 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 26 Dec 2020 06:04:43 +0000 (22:04 -0800)
commitbe53a7a37e9159dfd7e629e92b08c708d339f162
tree723f10f42f540c2b222f7db42bb38706ac682b7f
parentcb3c3f916a0ef91a758aa3b6795ad8fb038d00af
cairo: Avoid using cairo_t for a destroyed cairo_surface_t.

xr_pager_destroy() would destroy the latest cairo_t, if there was one.
Generally there wasn't, since in the common case it got destroyed by
xr_pager_run() when the fsm emptied out, but in the case of the last page
in a produced output file, xr_destroy() would call xr_pager_destroy()
after first destroying the surface_t it was drawing on.  I don't think this
is an actual bug, because everything is properly reference-counted inside
Cairo (the cairo_t holds a reference on its cairo_surface_t) but I found it
confusing.
src/output/cairo-pager.c
src/output/cairo-pager.h
src/output/cairo.c