Repository navigation
gh-162654: Fix use-after-free in tkinter file handlers - #163180
serhiy-storchaka wants to merge 1 commit into
Conversation
* deletefilehandler() now releases the callback and the file object after calling Tcl_DeleteFileHandler(). * Releasing them no longer crashes if a finalizer modifies the list of handlers. * The list of handlers is now per-thread, like in Tcl. * createfilehandler() now releases the replaced handler immediately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I think the new thread-local list needs an explicit teardown path. Each entry in The thread-local storage for the list head being reclaimed by Tcl does not, by itself, release the separately allocated The current I haven't reproduced the leak yet, so this is a lifecycle concern from the ownership paths rather than a confirmed runtime failure. |
deletefilehandler()now releases the callback and the file object after callingTcl_DeleteFileHandler().createfilehandler()now releases the replaced handler immediately.🤖 Generated with Claude Code
FileHandler()whendeletefilehandler()runs a__del__that services the event loop #162654