changeset 27195:005ebb9c8b8f v8.2.4126

patch 8.2.4126: crash on exit when built with dynamic Tcl Commit: https://github.com/vim/vim/commit/afa76e1cf2e7e1f9e1097e345a4272e9ddbf14ad Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 17 21:34:38 2022 +0000 patch 8.2.4126: crash on exit when built with dynamic Tcl Problem: Crash on exit when built with dynamic Tcl and EXITFREE is defined. (Dominique Pell?) Solution: Only call Tcl_Finalize() when initialized. (closes #9546)
author Bram Moolenaar <Bram@vim.org>
date Mon, 17 Jan 2022 22:45:04 +0100
parents 421d345d0189
children ee01902c9e73
files src/if_tcl.c src/version.c
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/if_tcl.c
+++ b/src/if_tcl.c
@@ -248,14 +248,6 @@ vim_tcl_init(char *arg)
 #endif
 }
 
-#if defined(EXITFREE) || defined(PROTO)
-    void
-vim_tcl_finalize(void)
-{
-    Tcl_Finalize();
-}
-#endif
-
 #if defined(DYNAMIC_TCL) || defined(PROTO)
 
 static int stubs_initialized = FALSE;
@@ -287,6 +279,17 @@ tcl_enabled(int verbose)
 }
 #endif
 
+#if defined(EXITFREE) || defined(PROTO)
+    void
+vim_tcl_finalize(void)
+{
+# ifdef DYNAMIC_TCL
+    if (stubs_initialized)
+# endif
+	Tcl_Finalize();
+}
+#endif
+
     void
 tcl_end(void)
 {
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4126,
+/**/
     4125,
 /**/
     4124,