Skip to content

Commit 2738a70

Browse files
committed
fix resurface crash with png, svg canvases
Regressed in 3dca82a This was originally added in cfc6dfd, but I don't think that assessment is right at least for the current bug: cairo_destroy, called after the backend's SetWidth, still holds a reference to the surface and calls the closure (presumably for leading <svg> or something?). I can't get it to happen consistently enough to write a test, sadly. Fixes #2520
1 parent 7a942d4 commit 2738a70

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/backend/PdfBackend.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ cairo_surface_t* PdfBackend::ensureSurface() {
2222

2323
void PdfBackend::destroySurface() {
2424
if (surface) {
25+
cairo_surface_finish(surface);
2526
cairo_surface_destroy(surface);
2627
surface = nullptr;
2728
assert(_closure);

src/backend/SvgBackend.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ cairo_surface_t* SvgBackend::ensureSurface() {
2626

2727
void SvgBackend::destroySurface() {
2828
if (surface) {
29+
cairo_surface_finish(surface);
2930
cairo_surface_destroy(surface);
3031
surface = nullptr;
3132
assert(_closure);

0 commit comments

Comments
 (0)