freeIntRepProc audit
Closed / Fixed2857044fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2009-09-11 18:22:20
Brief discussion on chat concluded that the freeIntRepProc of any Tcl_ObjType ought to set the typePtr field to NULL so that the Tcl_Obj is not left in an inconsistent state. At least some freeIntRepProc's in the core fail to meet this expectation. Search and destroy.
nijtmansplain2009-09-14 15:00:45
Agreed, but shouln't that be the responsibility of the TclFreeIntRep macro? Currently, a lot of TclFreeIntRep calls are followed by setting (objPtr)->typePtr to NULL! The freeIntRepProc is not supposed to be called directly, so doing it in TclFreeIntRep has the advantage that it works for freeIntRep functions outside of the core as well.
dgpplain2009-09-14 23:43:51
Adding it to the TclFreeIntRep macro is a fine idea too, but can only help the callers of the macro. Since the macro is private, the only callers ought to be within Tcl itself. For the sake of extensions, we still need each freeIntRepProc to do its own housekeeping as well. Yes, this is a gap in the interface. We ought to have a public routine that plays this role.
dgpplain2009-09-30 10:11:32
Tcl sources updated. Tk still needs a look.
dgpplain2009-11-20 07:20:39
Thanks for getting the bits I missed in tclEncoding.c. Just committed the other missed bits in tclVar.c. Still open for Tk.
dkfplain2009-11-22 00:27:59
All fixed in Tk HEAD. Leaving to dgp to decide whether that means this item should be closed.
dkf Ticket [2857044fff]: 4 changes
[History diff]2009-11-22 00:28:00
dgpplain2009-11-23 23:34:39
allow_comments - 1
Log in (anonymous is fine) to add a comment.