diff options
author | sebres <sebres@users.sourceforge.net> | 2017-07-03 13:23:31 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-07-03 13:23:31 (GMT) |
commit | 13a39efcafa31a2d71bd8b642e02f9235a34bfda (patch) | |
tree | cb9ca4991154875151170ebfb61457272742a595 /generic | |
parent | 420147bdad4cfcba7f38fb2497d6a1848c22d162 (diff) | |
download | tcl-13a39efcafa31a2d71bd8b642e02f9235a34bfda.zip tcl-13a39efcafa31a2d71bd8b642e02f9235a34bfda.tar.gz tcl-13a39efcafa31a2d71bd8b642e02f9235a34bfda.tar.bz2 |
bug fix: wrong release of after-id tcl-object if it switch type (object leak)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclTimer.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 5a34260..041163b 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -1464,12 +1464,15 @@ AfterProc( } /* release object (mark it was triggered) */ - if (afterPtr->selfPtr && afterPtr->selfPtr->typePtr == &afterObjType) { - afterPtr->selfPtr->internalRep.twoPtrValue.ptr1 = NULL; + if (afterPtr->selfPtr) { + if (afterPtr->selfPtr->typePtr == &afterObjType) { + afterPtr->selfPtr->internalRep.twoPtrValue.ptr1 = NULL; + } Tcl_DecrRefCount(afterPtr->selfPtr); + afterPtr->selfPtr = NULL; } - /* detach entry from the owner's list */ + /* detach after-entry from the owner's list */ TclSpliceOutEx(afterPtr, assocPtr->firstAfterPtr, assocPtr->lastAfterPtr); /* @@ -1518,13 +1521,16 @@ FreeAfterPtr( AfterInfo *afterPtr = (AfterInfo *) clientData; AfterAssocData *assocPtr = afterPtr->assocPtr; - /* release object (mark it was triggered) */ - if (afterPtr->selfPtr && afterPtr->selfPtr->typePtr == &afterObjType) { - afterPtr->selfPtr->internalRep.twoPtrValue.ptr1 = NULL; + /* release object (mark it was removed) */ + if (afterPtr->selfPtr) { + if (afterPtr->selfPtr->typePtr == &afterObjType) { + afterPtr->selfPtr->internalRep.twoPtrValue.ptr1 = NULL; + } Tcl_DecrRefCount(afterPtr->selfPtr); + afterPtr->selfPtr = NULL; } - /* detach entry from the owner's list */ + /* detach after-entry from the owner's list */ TclSpliceOutEx(afterPtr, assocPtr->firstAfterPtr, assocPtr->lastAfterPtr); /* free command of entry */ |