diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2024-08-06 11:17:14 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2024-08-06 11:17:14 (GMT) |
| commit | b382ec8def7fd37667aaf1142154fa184a53137d (patch) | |
| tree | 0f5c6847d3561a893c02c9373c5a0b5b2b80411f /generic/tclOO.c | |
| parent | 6c8dcb0ebac4f7d3cb9ad04a26c1533b89d6290e (diff) | |
| parent | d067bc4e9d912461ed88f970f84183f2ae046b81 (diff) | |
| download | tcl-b382ec8def7fd37667aaf1142154fa184a53137d.zip tcl-b382ec8def7fd37667aaf1142154fa184a53137d.tar.gz tcl-b382ec8def7fd37667aaf1142154fa184a53137d.tar.bz2 | |
Force named namespaces to be made by TclOO. [154f0982f2]
Diffstat (limited to 'generic/tclOO.c')
| -rw-r--r-- | generic/tclOO.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index 46d81c9..3b144f7 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -604,6 +604,10 @@ KillFoundation( * call TclOOAddToSubclasses() to add it to the right class's list of * subclasses. * + * Returns: + * Pointer to the object structure created, or NULL if a specific + * namespace was asked for but couldn't be created. + * * ---------------------------------------------------------------------- */ @@ -646,11 +650,16 @@ AllocObject( if (nsNameStr != NULL) { oPtr->namespacePtr = Tcl_CreateNamespace(interp, nsNameStr, oPtr, NULL); - if (oPtr->namespacePtr != NULL) { - creationEpoch = ++fPtr->tsdPtr->nsCount; - goto configNamespace; + if (oPtr->namespacePtr == NULL) { + /* + * Couldn't make the specific namespace. Report as an error. + * [Bug 154f0982f2] + */ + ckfree(oPtr); + return NULL; } - Tcl_ResetResult(interp); + creationEpoch = ++fPtr->tsdPtr->nsCount; + goto configNamespace; } while (1) { @@ -1875,6 +1884,9 @@ TclNewObjectInstanceCommon( */ oPtr = AllocObject(interp, simpleName, nsPtr, nsNameStr); + if (oPtr == NULL) { + return NULL; + } oPtr->selfCls = classPtr; AddRef(classPtr->thisPtr); TclOOAddToInstances(oPtr, classPtr); |
