@@ -82,6 +82,7 @@ int cmd_argc;
8282char ** cmd_argv;
8383static const char * log_filename = nullptr ;
8484static const char * metrics_filename = nullptr ;
85+ static std::set<std::string>* commands = nullptr ;
8586static bool no_settings = false ;
8687static bool minimize = false ;
8788
@@ -295,6 +296,7 @@ int main(int argc, char* argv[])
295296 // Set argc to 1 so Tcl_Main doesn't source any files.
296297 // Tcl_Main never returns.
297298 Tcl_Main (1 , argv, ord::tclAppInit);
299+ delete commands;
298300 return 0 ;
299301}
300302
@@ -454,15 +456,15 @@ static int tclAppInit(int& argc,
454456 showSplash ();
455457 }
456458
457- std::set<std::string> commands ;
459+ commands = new std::set<std::string>() ;
458460 if (Tcl_Eval (interp, " array names sta::cmd_args" ) == TCL_OK) {
459461 Tcl_Obj* cmd_names = Tcl_GetObjResult (interp);
460462 int cmd_size;
461463 Tcl_Obj** cmds_objs;
462464 if (Tcl_ListObjGetElements (interp, cmd_names, &cmd_size, &cmds_objs)
463465 == TCL_OK) {
464466 for (int i = 0 ; i < cmd_size; i++) {
465- commands. insert (Tcl_GetString (cmds_objs[i]));
467+ commands-> insert (Tcl_GetString (cmds_objs[i]));
466468 }
467469 }
468470 }
@@ -471,7 +473,7 @@ static int tclAppInit(int& argc,
471473 0 ,
472474 TCL_ALLOW_INLINE_COMPILATION, // In this case, traces on built-in commands may or may not result in trace callbacks.
473475 TraceTclCommand,
474- & commands,
476+ commands,
475477 nullptr
476478 );
477479 const char * threads = findCmdLineKey (argc, argv, " -threads" );
0 commit comments