From 57c6774a047cec33e79859efe88a2be96dfc526a Mon Sep 17 00:00:00 2001 From: sfeam Date: Thu, 21 Sep 2017 18:22:12 +0000 Subject: [PATCH] revert change to cairotrm_reset --- ChangeLog | 6 ++++++ term/cairo.trm | 11 +++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index d77393cb1..4ed796fff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-09-20 Ethan A Merritt + + * term/cairo.trm (cairotrm_reset): Revert change. + 2017-09-19 Ethan A Merritt * term/cairo.trm (cairotrm_init cairotrm_reset): Valgrind complained @@ -6,6 +10,8 @@ It does make sense to call it if the terminal has been closed and then reopened. So we fix the ordering of code in cairotrm_init that frees the old plot.cr before reinitializing a new one. + REVERT: This change caused some cairo installations to close pdf output + file without proper termination of the contents. * src/parse.c (parse_array_assignment): Memory leak. diff --git a/term/cairo.trm b/term/cairo.trm index 67390fd1e..7cc2eac21 100644 --- a/term/cairo.trm +++ b/term/cairo.trm @@ -1,5 +1,5 @@ /* Hello, Emacs: this is -*-C-*- ! - * $Id: cairo.trm,v 1.80 2017-09-19 20:15:10 sfeam Exp $ + * $Id: cairo.trm,v 1.81 2017-09-21 18:22:12 sfeam Exp $ */ /* GNUPLOT - cairo.trm */ @@ -973,13 +973,8 @@ void cairotrm_text() /* sent when gnuplot exits and when the terminal or the output change.*/ void cairotrm_reset() { - /* Sep 2017 - * valgrind complains that this triggers reads of already-freed data. - * It is unclear whether that is a real problem, but it is also unclear - * that anything is gained by explicit cleanup when we are about to exit. - * Let's try skipping it and see if anyone notices. - */ - /* cairo_destroy(plot.cr); */ + if (plot.cr) + cairo_destroy(plot.cr); #ifdef PSLATEX_DRIVER /* finish latex output */