From 610189787a3819b2e9388529764b17d4bf2ff7d6 Mon Sep 17 00:00:00 2001 From: Clifford Yapp <238416+starseeker@users.noreply.github.com> Date: Mon, 4 Dec 2023 15:07:06 -0500 Subject: [PATCH] av array is local to the db_walk_tree stage --- src/libged/facetize/tri_booleval.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/libged/facetize/tri_booleval.cpp b/src/libged/facetize/tri_booleval.cpp index 7d69c5f5f31..3911ebf8549 100644 --- a/src/libged/facetize/tri_booleval.cpp +++ b/src/libged/facetize/tri_booleval.cpp @@ -497,10 +497,6 @@ _ged_facetize_booleval(struct _ged_facetize_state *s, int argc, struct directory // Open working .g copy with BoTs replacing CSG solids and perform // the tree walk to set up Manifold data. Using the working copy // means we will be getting the correct triangle data for each solid - const char **av = (const char **)bu_calloc(argc+1, sizeof(char *), "av"); - for (int i = 0; i < argc; i++) { - av[i] = dpa[i]->d_namep; - } struct db_i *wdbip = db_open(wfile, DB_OPEN_READONLY); if (!wdbip) return BRLCAD_ERROR; @@ -509,9 +505,15 @@ _ged_facetize_booleval(struct _ged_facetize_state *s, int argc, struct directory db_update_nref(wdbip, &rt_uniresource); struct rt_wdb *wwdbp = wdb_dbopen(wdbip, RT_WDB_TYPE_DB_DEFAULT); - /* Second stage is to instance the BoTs generated by stage 1 and - * prepare Manifold inputs for evaluation */ + /* Second stage is to prepare Manifold versions of the instances of the BoT + * obj conversions generated by stage 1. This is where matrix placement + * is handled. */ { + // Prepare argc/argv array for db_walk_tree + const char **av = (const char **)bu_calloc(argc+1, sizeof(char *), "av"); + for (int i = 0; i < argc; i++) { + av[i] = dpa[i]->d_namep; + } struct db_tree_state init_state; db_init_db_tree_state(&init_state, wdbip, wwdbp->wdb_resp); /* Establish tolerances */ @@ -537,10 +539,11 @@ _ged_facetize_booleval(struct _ged_facetize_state *s, int argc, struct directory } BU_UNSETJUMP; if (i < 0) { + bu_free(av, "av"); return -1; } + bu_free(av, "av"); } - bu_free(av, "av"); // TODO - We don't have a tree - whether that's an error or not depends if (!s->facetize_tree) {