diff --git a/src/mged/cmd.c b/src/mged/cmd.c index 38fad5d307..d4997ac687 100644 --- a/src/mged/cmd.c +++ b/src/mged/cmd.c @@ -1414,8 +1414,6 @@ f_quit(ClientData clientData, Tcl_Interp *interpreter, int argc, const char *arg MGED_CK_CMD(ctp); struct mged_state *s = ctp->s; - BU_PUT (MGED_STATE, struct mged_state); - if (argc < 1 || 1 < argc) { struct bu_vls vls = BU_VLS_INIT_ZERO; @@ -1993,7 +1991,7 @@ cmd_tol(ClientData clientData, Tcl_Interp *interpreter, int argc, const char *ar /* defined in chgview.c */ -extern int edit_com(int argc, const char *argv[]); +extern int edit_com(struct mged_state *s, int argc, const char *argv[]); /** * Run ged_blast, then update the views @@ -2088,7 +2086,7 @@ cmd_draw(ClientData clientData, Tcl_Interp *UNUSED(interpreter), int argc, const gvp->gv_height = dm_get_height(DMP); } - return edit_com(argc, argv); + return edit_com(s, argc, argv); } @@ -2096,12 +2094,15 @@ cmd_draw(ClientData clientData, Tcl_Interp *UNUSED(interpreter), int argc, const * Format: ev objects */ int -cmd_ev(ClientData UNUSED(clientData), +cmd_ev(ClientData clientData, Tcl_Interp *UNUSED(interpreter), int argc, const char *argv[]) { - return edit_com(argc, argv); + struct cmdtab *ctp = (struct cmdtab *)clientData; + MGED_CK_CMD(ctp); + struct mged_state *s = ctp->s; + return edit_com(s, argc, argv); } @@ -2110,12 +2111,15 @@ cmd_ev(ClientData UNUSED(clientData), * display). Usage: E object(s) */ int -cmd_E(ClientData UNUSED(clientData), +cmd_E(ClientData clientData, Tcl_Interp *UNUSED(interpreter), int argc, const char *argv[]) { - return edit_com(argc, argv); + struct cmdtab *ctp = (struct cmdtab *)clientData; + MGED_CK_CMD(ctp); + struct mged_state *s = ctp->s; + return edit_com(s, argc, argv); } diff --git a/src/mged/f_db.c b/src/mged/f_db.c index 5a19d5f449..f1b973d05c 100644 --- a/src/mged/f_db.c +++ b/src/mged/f_db.c @@ -345,6 +345,7 @@ f_opendb(ClientData clientData, Tcl_Interp *interpreter, int argc, const char *a struct mged_opendb_ctx ctx; ctx.old_dbip = NULL; + ctx.s = s; if (argc <= 1) { /* Invoked without args, return name of current database */ diff --git a/src/mged/mged.c b/src/mged/mged.c index a348f28475..1e3ec6a7cf 100644 --- a/src/mged/mged.c +++ b/src/mged/mged.c @@ -2551,6 +2551,8 @@ mged_finish(struct mged_state *s, int exitcode) mged_global_variable_teardown(INTERP); + BU_PUT (MGED_STATE, struct mged_state); + /* 8.5 seems to have some bugs in their reference counting */ /* Tcl_DeleteInterp(INTERP); */