Hi Gustaf,
Have you fixed or considered fixing this issue? I see this in 1.3.6. Is there a way to set the beginning handle number?
xotclsh
% Object ::xotcl::__#0 ::xotcl::__#0 % Object new ::xotcl::__#0 %
Thanks,
Ben
Ben Thomasson schrieb:
Hi Gustaf,
Have you fixed or considered fixing this issue?
Hi Ben,
we have discussed this here, but we have not released any code in this direction yet. The included patch will be in 1.3.7 and prevents overwriting of objects through new.
cd xotcl-1.3.6 patch -p0 < /tmp/new-patch
best regards -gustaf
--- generic/xotcl.c-1.3.6 Mon Apr 18 10:37:42 2005 +++ generic/xotcl.c Mon Apr 18 10:27:57 2005 @@ -8874,7 +8902,7 @@ #if REFCOUNTED isrefcount = 0, #endif - i; + i, prefixLength; Tcl_DString dFullname, *dsPtr = &dFullname; XOTclStringIncrStruct *iss = &RUNTIME_STATE(in)->iss;
@@ -8906,8 +8934,16 @@ } else { Tcl_DStringAppend(dsPtr, "::xotcl::__#", 12); } - (void)XOTclStringIncr(iss); - Tcl_DStringAppend(dsPtr, iss->start, iss->length); + prefixLength = dsPtr->length; + + while (1) { + (void)XOTclStringIncr(iss); + Tcl_DStringAppend(dsPtr, iss->start, iss->length); + if (!Tcl_FindCommand(in, Tcl_DStringValue(dsPtr), NULL, 0)) { + break; + } + Tcl_DStringSetLength(dsPtr, prefixLength); + }
fullname = Tcl_NewStringObj(Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr));