Skip to content

Commit

Permalink
backout [b569739692]: [02977e0004] Reduce impact of recursion depth bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Nov 10, 2024
1 parent 4ab16b8 commit 74b66d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 43 deletions.
42 changes: 4 additions & 38 deletions generic/tclOO.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ MyClassDeleted(
static void
ObjectRenamedTrace(
void *clientData, /* The object being deleted. */
Tcl_Interp *interp,
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(const char *) /*oldName*/,
TCL_UNUSED(const char *) /*newName*/,
int flags) /* Why was the object deleted? */
Expand All @@ -887,44 +887,10 @@ ObjectRenamedTrace(
*/

if (!Destructing(oPtr)) {
/*
* Ensure that we don't recurse very deeply and blow out the C stack.
* [Bug 02977e0004]
*/
ThreadLocalData *tsdPtr = GetFoundation(interp)->tsdPtr;
if (oPtr->classPtr) {
/*
* Classes currently need the recursion to get destructor calling
* right. This is a bug, but it requires a major rewrite of things
* to fix.
*/
Tcl_DeleteNamespace(oPtr->namespacePtr);
oPtr->command = NULL;
TclOODecrRefCount(oPtr);
} else if (!tsdPtr->delQueueTail) {
/*
* Process a queue of objects to delete.
*/
Object *currPtr, *tmp;
tsdPtr->delQueueTail = oPtr;
for (currPtr = oPtr; currPtr; currPtr = tmp) {
Tcl_DeleteNamespace(currPtr->namespacePtr);
currPtr->command = NULL;
tmp = currPtr->delNext;
TclOODecrRefCount(currPtr);
}
tsdPtr->delQueueTail = NULL;
} else {
/*
* Enqueue the object.
*/
tsdPtr->delQueueTail->delNext = oPtr;
tsdPtr->delQueueTail = oPtr;
}
} else {
oPtr->command = NULL;
TclOODecrRefCount(oPtr);
Tcl_DeleteNamespace(oPtr->namespacePtr);
}
oPtr->command = NULL;
TclOODecrRefCount(oPtr);
return;
}

Expand Down
4 changes: 0 additions & 4 deletions generic/tclOOInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ struct Object {
PropertyStorage properties; /* Information relating to the lists of
* properties that this object *claims* to
* support. */
Object *delNext; /* If non-NULL, the next object to have its
* namespace deleted. */
};

enum ObjectFlags {
Expand Down Expand Up @@ -376,8 +374,6 @@ typedef struct ThreadLocalData {
* because Tcl_Objs can cross interpreter
* boundaries within a thread (objects don't
* generally cross threads). */
Object *delQueueTail; /* The tail object in the deletion queue. If
* NULL, there is no deletion queue. */
} ThreadLocalData;

/*
Expand Down
2 changes: 1 addition & 1 deletion tests/oo.test
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ test oo-1.22 {basic test of OO functionality: nested ownership destruction order
} -result {1 2 3 4 0}
test oo-1.23 {basic test of OO functionality: deep nested ownership} -setup {
oo::class create parent
} -body {
} -constraints knownBug -body {
oo::class create abc {
superclass parent
method make {} {[self class] create xyz}
Expand Down

0 comments on commit 74b66d9

Please sign in to comment.