summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclVar.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index bdc64b7..55eb91c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -4498,7 +4498,6 @@ TclDeleteNamespaceVars(
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr);
UnsetVarStruct(varPtr, NULL, iPtr, /* part1 */ objPtr,
NULL, flags);
- Tcl_DecrRefCount(objPtr); /* free no longer needed obj */
/*
* Remove the variable from the table and force it undefined in case
@@ -4527,6 +4526,12 @@ TclDeleteNamespaceVars(
}
}
}
+
+ if (!TclIsVarUndefined(varPtr)) {
+ UnsetVarStruct(varPtr, NULL, iPtr, /* part1 */ objPtr,
+ NULL, flags);
+ }
+ Tcl_DecrRefCount(objPtr); /* free no longer needed obj */
VarHashRefCount(varPtr)--;
VarHashDeleteEntry(varPtr);
}