Overview
| Artifact ID: | 8bfac5a59ae74cb20da35cd4c2ea8c15547de16a12e71646a834359ddbc0059c |
|---|---|
| Ticket: | 24d7f1a69572ef507638447eb87ccce0c9d489b9
Recursive [namespace delete] causes a segfault |
| User & Date: | chw on 2025-12-07 19:48:02 |
Changes
- icomment:
What about this patch? ---snip--- Index: generic/tclNamesp.c ================================================================== --- generic/tclNamesp.c +++ generic/tclNamesp.c @@ -2538,14 +2538,21 @@ TclEnsureNamespace( Tcl_Interp *interp, Tcl_Namespace *namespacePtr) { Namespace *nsPtr = (Namespace *) namespacePtr; + Tcl_Namespace *newNsPtr; + if (!(nsPtr->flags & NS_DYING)) { - return namespacePtr; + return namespacePtr; } - return Tcl_CreateNamespace(interp, nsPtr->fullName, NULL, NULL); + newNsPtr = Tcl_CreateNamespace(interp, nsPtr->fullName, NULL, NULL); + if (newNsPtr == NULL) { + nsPtr->flags &= ~(NS_DYING|NS_KILLED); + newNsPtr = (Tcl_Namespace *) nsPtr; + } + return newNsPtr; } /* *---------------------------------------------------------------------- * ---snip--- - login: "chw"
- mimetype: "text/plain"