From 799e58d2cefd7d8c99413cde4397a1cfa3a5c817 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 25 Mar 2016 20:01:39 +0000 Subject: irPtr = NULL passed to Tcl_StoreIntRep clears out any value for typePtr. --- generic/tclObj.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/generic/tclObj.c b/generic/tclObj.c index 3341fcd..7db9ff9 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1840,11 +1840,14 @@ Tcl_StoreIntRep( /* Clear out any existing IntRep ( "shimmer" ) */ TclFreeIntRep(objPtr); - /* Copy the new IntRep into place */ - objPtr->internalRep = *irPtr; + /* When irPtr == NULL, just leave objPtr with no IntRep for typePtr */ + if (irPtr) { + /* Copy the new IntRep into place */ + objPtr->internalRep = *irPtr; - /* Set the type to match */ - objPtr->typePtr = typePtr; + /* Set the type to match */ + objPtr->typePtr = typePtr; + } } /* -- cgit v0.12