Skip to content

Commit cfc6dfd

Browse files
committed
Call cairo_surface_finish in ~Canvas when pdf
Fixes an issue where when a pdf surface isn't buffered and then is garbage collected, the toBuffer can be called and attempt to realloc the destroyed closure.
1 parent 0d39dae commit cfc6dfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Canvas.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
//
32
// Canvas.cc
43
//
@@ -406,6 +405,7 @@ Canvas::Canvas(int w, int h, canvas_type_t t): ObjectWrap() {
406405
Canvas::~Canvas() {
407406
switch (type) {
408407
case CANVAS_TYPE_PDF:
408+
cairo_surface_finish(_surface);
409409
closure_destroy((closure_t *) _closure);
410410
free(_closure);
411411
cairo_surface_destroy(_surface);

0 commit comments

Comments
 (0)