From: erg Date: Thu, 16 Mar 2006 00:17:17 +0000 (+0000) Subject: Fix bug 906 - in layout cleanup, zero out Agraphinfo only if non-root X-Git-Tag: LAST_LIBGRAPH~32^2~6749 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c55b546e3965a8dfd2a66763961c4a8003e433bf;p=graphviz Fix bug 906 - in layout cleanup, zero out Agraphinfo only if non-root graph. For root graph, this is cleaned up in graph_cleanup. --- diff --git a/lib/circogen/circularinit.c b/lib/circogen/circularinit.c index 2348f8157..6aa254d53 100644 --- a/lib/circogen/circularinit.c +++ b/lib/circogen/circularinit.c @@ -340,5 +340,5 @@ void circo_cleanup(graph_t * g) circular_cleanup_node(n); } free(GD_neato_nlist(g)); - memset(&(g->u), 0, sizeof(Agraphinfo_t)); + if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t)); } diff --git a/lib/dotgen/dotinit.c b/lib/dotgen/dotinit.c index dbd71edf7..f12496c99 100644 --- a/lib/dotgen/dotinit.c +++ b/lib/dotgen/dotinit.c @@ -167,7 +167,7 @@ dot_cleanup_graph(graph_t * g) free(GD_rank(g)[i].v); free(GD_rank(g)); } - memset(&(g->u), 0, sizeof(Agraphinfo_t)); + if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t)); } /* delete the layout (but retain the underlying graph) */ diff --git a/lib/fdpgen/fdpinit.c b/lib/fdpgen/fdpinit.c index 57e7ed88c..710d63495 100644 --- a/lib/fdpgen/fdpinit.c +++ b/lib/fdpgen/fdpinit.c @@ -177,7 +177,7 @@ static void fdp_cleanup_graph(graph_t * g) cleanup_subgs(g); free(GD_neato_nlist(g)); free(GD_alg(g)); - memset(&(g->u), 0, sizeof(Agraphinfo_t)); + if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t)); } void fdp_cleanup(graph_t * g) diff --git a/lib/gvc/gvlayout.c b/lib/gvc/gvlayout.c index 9474635d9..1988abf62 100644 --- a/lib/gvc/gvlayout.c +++ b/lib/gvc/gvlayout.c @@ -77,6 +77,7 @@ int gvLayoutJobs(GVC_t * gvc, graph_t * g) * First, if the graph has a layout-specific cleanup function attached, * use it and reset. * Then, if the root graph has not been cleaned up, clean it up and reset. + * Only the root graph has GD_drawing non-null. */ int gvFreeLayout(GVC_t * gvc, graph_t * g) { diff --git a/lib/neatogen/neatoinit.c b/lib/neatogen/neatoinit.c index eb3b5bb8e..065f4eb79 100644 --- a/lib/neatogen/neatoinit.c +++ b/lib/neatogen/neatoinit.c @@ -177,7 +177,7 @@ void neato_cleanup_graph(graph_t * g) { if (Nop || (Pack < 0)) free_scan_graph(g); - memset(&(g->u), 0, sizeof(Agraphinfo_t)); + if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t)); } void neato_cleanup(graph_t * g) diff --git a/lib/twopigen/twopiinit.c b/lib/twopigen/twopiinit.c index 1cb4726d3..e9b7159f6 100644 --- a/lib/twopigen/twopiinit.c +++ b/lib/twopigen/twopiinit.c @@ -155,7 +155,7 @@ static void twopi_cleanup_edge(edge_t * e) static void twopi_cleanup_graph(graph_t * g) { free(GD_neato_nlist(g)); - memset(&(g->u), 0, sizeof(Agraphinfo_t)); + if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t)); } void twopi_cleanup(graph_t * g)