Skip to content

Commit

Permalink
av array is local to the db_walk_tree stage
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Dec 4, 2023
1 parent 50f4d2b commit 6101897
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/libged/facetize/tri_booleval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 */
Expand All @@ -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) {
Expand Down

0 comments on commit 6101897

Please sign in to comment.