From afa76e1cf2e7e1f9e1097e345a4272e9ddbf14ad Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 17 Jan 2022 21:34:38 +0000 Subject: [PATCH] patch 8.2.4126: crash on exit when built with dynamic Tcl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Problem: Crash on exit when built with dynamic Tcl and EXITFREE is defined. (Dominique Pellé) Solution: Only call Tcl_Finalize() when initialized. (closes #9546) --- src/if_tcl.c | 19 +++++++++++-------- src/version.c | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/if_tcl.c b/src/if_tcl.c index 75f904a9e..f66bfd386 100644 --- 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; @@ -285,6 +277,17 @@ tcl_enabled(int verbose) } return stubs_initialized; } +#endif + +#if defined(EXITFREE) || defined(PROTO) + void +vim_tcl_finalize(void) +{ +# ifdef DYNAMIC_TCL + if (stubs_initialized) +# endif + Tcl_Finalize(); +} #endif void diff --git a/src/version.c b/src/version.c index 735b8f6f8..6fb6181da 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 4126, /**/ 4125, /**/ -- 2.50.1