From: ellson Date: Wed, 19 Jul 2006 20:06:28 +0000 (+0000) Subject: fix for bug# 979 - initialize GC stack before first use X-Git-Tag: LAST_LIBGRAPH~32^2~6060 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73a1d5945da3ec0879476ef81183f45e8dc1df5c;p=graphviz fix for bug# 979 - initialize GC stack before first use --- diff --git a/lib/common/hpglgen.c b/lib/common/hpglgen.c index 263659242..8d00c5ab7 100644 --- a/lib/common/hpglgen.c +++ b/lib/common/hpglgen.c @@ -402,6 +402,13 @@ hpgl_begin_job(FILE * ofp, graph_t * g, char **lib, char *user, { /* Pages = pages; */ N_pages = pages.x * pages.y; + initGC(); +} + +static void +hpgl_end_job(void) +{ + destroyGC(); } static void hpgl_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb) @@ -445,7 +452,6 @@ static void hpgl_begin_page(graph_t * g, point page, double scale, int rot, #if 0 /* not used */ initTextAlign(); #endif - initGC(); if (N_pages > 1) { saveGC(); @@ -502,7 +508,6 @@ static void hpgl_end_page(void) sprintf(buffer, "PU%sSP0%sPG;\n", Sep, Sep); /* pen up; advance page */ output(buffer); output(suffix); - destroyGC(); } static void hpgl_begin_context(void) @@ -835,7 +840,7 @@ static void hpgl_usershape(usershape_t *us, boxf p, point *A, int n, bool filled codegen_t HPGL_CodeGen = { hpgl_reset, - hpgl_begin_job, 0, /* hpgl_end_job */ + hpgl_begin_job, hpgl_end_job, hpgl_begin_graph, 0, /* hpgl_end_graph */ hpgl_begin_page, hpgl_end_page, 0, /* hpgl_begin_layer */ 0, /* hpgl_end_layer */