save / restore tcl context when creating / destroying preview window

This commit is contained in:
stefan schippers 2023-12-05 18:50:46 +01:00
parent b8fecf997b
commit 8269eff430
1 changed files with 2 additions and 0 deletions

View File

@ -1172,6 +1172,7 @@ void preview_window(const char *what, const char *win_path, const char *fname)
}
else if(!strcmp(what, "draw")) {
dbg(1, "preview_window() draw\n");
tclvareval("save_ctx ", xctx->current_win_path, NULL);
save_xctx = xctx; /* save current schematic */
xctx = preview_xctx;
if(!current_file || strcmp(fname, current_file) ) {
@ -1206,6 +1207,7 @@ void preview_window(const char *what, const char *win_path, const char *fname)
Tk_DestroyWindow(tkpre_window);
my_free(_ALLOC_ID_, &current_file);
xctx = save_xctx; /* restore schematic */
tclvareval("restore_ctx ", xctx->current_win_path, NULL);
save_xctx = NULL;
set_modify(-1);
}