Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,14 @@ static int
Tktt_Clear(PyObject *op)
{
TkttObject *self = TkttObject_CAST(op);
Py_CLEAR(self->func);
if (self->token != NULL) {
Tcl_DeleteTimerHandler(self->token);
self->token = NULL;
}
if (self->func != NULL) {
Py_CLEAR(self->func);
Py_DECREF(op); /* See Tktt_New() */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I'm probably missing something -- why do we have that extra reference in the first place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent the result of createtimerhandler() from being collected before the timer fires.

}
return 0;
}

Expand All @@ -2783,6 +2790,9 @@ Tktt_Traverse(PyObject *op, visitproc visit, void *arg)
{
TkttObject *self = TkttObject_CAST(op);
Py_VISIT(Py_TYPE(op));
if (self->token != NULL) {
Py_VISIT(op); /* See Tktt_New() */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something, but won't this just lead to infinite recursion?

}
Py_VISIT(self->func);
return 0;
}
Expand Down
Loading