No registered users in community xowiki
in last 10 minutes
in last 10 minutes
[Xotcl] Re: new doesnt check for existing object handle.
From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Mon, 18 Apr 2005 10:47:43 +0200
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
_at_@ -8874,7 +8902,7 @@
#if REFCOUNTED
isrefcount = 0,
#endif
- i;
+ i, prefixLength;
Tcl_DString dFullname, *dsPtr = &dFullname;
XOTclStringIncrStruct *iss = &RUNTIME_STATE(in)->iss;
_at_@ -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));
Date: Mon, 18 Apr 2005 10:47:43 +0200
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
_at_@ -8874,7 +8902,7 @@
#if REFCOUNTED
isrefcount = 0,
#endif
- i;
+ i, prefixLength;
Tcl_DString dFullname, *dsPtr = &dFullname;
XOTclStringIncrStruct *iss = &RUNTIME_STATE(in)->iss;
_at_@ -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));