]> granicus.if.org Git - graphviz/commitdiff
Fix bug 906 - in layout cleanup, zero out Agraphinfo only if non-root
authorerg <devnull@localhost>
Thu, 16 Mar 2006 00:17:17 +0000 (00:17 +0000)
committererg <devnull@localhost>
Thu, 16 Mar 2006 00:17:17 +0000 (00:17 +0000)
graph. For root graph, this is cleaned up in graph_cleanup.

lib/circogen/circularinit.c
lib/dotgen/dotinit.c
lib/fdpgen/fdpinit.c
lib/gvc/gvlayout.c
lib/neatogen/neatoinit.c
lib/twopigen/twopiinit.c

index 2348f8157814a4b73f6af361d68b51070761de10..6aa254d534164b9aa9b649a4e4a0ad4e46a9c574 100644 (file)
@@ -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));
 }
index dbd71edf727b4ab71083bd482e60a6f254cb4d21..f12496c9926fa69b709ab936e6f95b3fbcf4b2d4 100644 (file)
@@ -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) */
index 57e7ed88c645428a45440dd568b23698f499a5f7..710d63495cd3fc5e92e195a7fad92ae02eaa3f2b 100644 (file)
@@ -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)
index 9474635d960a50ba914cb2c22dad87ae1546babc..1988abf62bd7ab78af5da871f484b611250b2cfb 100644 (file)
@@ -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)
 {
index eb3b5bb8ec34c8500ac048be2e1fa54273c1a6a9..065f4eb79298dbf7ca707b1b1002d8b52cb0bc71 100644 (file)
@@ -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)
index 1cb4726d3577b41be914acc0c4ff3081970923a6..e9b7159f6e4385879c5eabb2600fde984934c72e 100644 (file)
@@ -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)