From cfc6dfd714772af87e814a687230ae16b4690182 Mon Sep 17 00:00:00 2001 From: Chris Spencer Date: Wed, 19 Dec 2012 09:38:40 +0000 Subject: [PATCH] Call cairo_surface_finish in ~Canvas when pdf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/Canvas.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Canvas.cc b/src/Canvas.cc index 27ceb16..e4a2779 100644 --- a/src/Canvas.cc +++ b/src/Canvas.cc @@ -1,4 +1,3 @@ - // // Canvas.cc // @@ -406,6 +405,7 @@ Canvas::Canvas(int w, int h, canvas_type_t t): ObjectWrap() { Canvas::~Canvas() { switch (type) { case CANVAS_TYPE_PDF: + cairo_surface_finish(_surface); closure_destroy((closure_t *) _closure); free(_closure); cairo_surface_destroy(_surface);