From 98c6b22c1002fae94f8abf7422758530a9a6fdeb Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 8 Nov 2017 02:21:49 +0000 Subject: TclOO object allocation: Set classPtr to NULL if it wasn't otherwise set. --- generic/tclOO.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index ec666ee..f236ac9 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -537,7 +537,8 @@ KillFoundation( * AllocObject -- * * Allocate an object of basic type. Does not splice the object into its - * class's instance list. + * class's instance list. The caller must set the classPtr on the object, + * either to a class or to NULL. * * ---------------------------------------------------------------------- */ @@ -1672,6 +1673,8 @@ Tcl_NewObjectInstance( AllocClass(interp, oPtr); oPtr->selfCls = classPtr; TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls); + } else { + oPtr->classPtr = NULL; } /* -- cgit v0.12