From 9a6006c291314d6020867e5876281c7dc42c3a02 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Fri, 28 Mar 2025 13:43:39 +0100 Subject: [PATCH] fix potential crash on close multiple windows / tabs (destroy_all_tabs(), destroy_all_windows() ) --- src/xinit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xinit.c b/src/xinit.c index 772d6b83..278a92c7 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -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)--;