fix potential crash on close multiple windows / tabs (destroy_all_tabs(), destroy_all_windows() )

This commit is contained in:
stefan schippers 2025-03-28 13:43:39 +01:00
parent 1d2bff5f9b
commit 9a6006c291
1 changed files with 2 additions and 2 deletions

View File

@ -1947,9 +1947,9 @@ static void destroy_all_windows(int *window_count, int force)
tclvareval("winfo toplevel ", window_path[i], NULL);
my_strdup2(_ALLOC_ID_, &toplevel, tclresult());
}
delete_schematic_data(1);
/* set saved ctx to main window if previous is about to be destroyed */
if(savectx == save_xctx[i]) savectx = save_xctx[0];
delete_schematic_data(1);
save_xctx[i] = NULL;
if(has_x) {
Tk_DestroyWindow(Tk_NameToWindow(interp, window_path[i], mainwindow));
@ -1999,9 +1999,9 @@ static void destroy_all_tabs(int *window_count, int force)
/* delete Tcl context of deleted schematic window */
tclvareval("delete_ctx ", window_path[i], NULL);
if(has_x) tclvareval("delete_tab ", window_path[i], NULL);
delete_schematic_data(1);
/* set saved ctx to main window if previous is about to be destroyed */
if(savectx == save_xctx[i]) savectx = save_xctx[0];
delete_schematic_data(1);
save_xctx[i] = NULL;
my_strncpy(window_path[i], "", S(window_path[i]));
(*window_count)--;