Skip to content
Tcl Source Code View Ticket
Login

View Ticket

No Tcl_CmdDeleteProc call when string command replaced by obj command

Closed / Fixeda16752c25254181ce5edef8cdc29b039d3e46885Created 13 years agoUpdated 8 years ago
Descriptionplain2013-08-14 16:29:11
This has been broken as long as Tcl source
code history goes back.  When a command created
by Tcl_CreateCommand is overwritten by a new command
created by Tcl_CreateObjCommand, its deletion callback
is never called.  There is special explicit code in
place to make this mistake.  "What were they thinking?"

Here's the demo, using testing commands already available:

% testdel {} foo {puts bar}
% proc foo args {}
%
Referenced by7
  • 4a8c5ad29aRemove hacked exception for bug [a16752c252]. Should be fixed by then in "tclcompiler". Taken over from "novem". check-in2019-03-24 18:12:30
  • ccccdf967cFully fix old bug [a16752c252] that has been only partially fixed until now to support legacy tclcompiler binaries. That no longer makes sense for Tcl 9. check-in2016-07-07 17:00:01
  • d041733320[86ceb4e2b6] Improve reaction when multiple *tm files purport to offer the same version of the same package. Prefer the file that comes first on the tm path. Makes TCL*_TM_PATH variables more useful. Thanks to Gustaf Neumann for the suggestion. [a16752c252] Revise (partially revert) bug fix to stop crashes in buggy tclcompiler. check-in2013-09-07 22:19:49
  • d7ad86353fPartial revert of [a16752c252] bug fix to stop crashes in buggy tclcompiler. check-in2013-09-07 18:49:55
  • cd9e4957c5Partial revert of [a16752c252] bug fix to stop crashes in buggy tclcompiler. check-in2013-09-05 17:21:41
  • 2718a160f1[a16752c252] Correct failure to call cmd deletion callbacks. check-in2013-08-14 17:07:00
  • 746ec0f768[a16752c252] Correct failure to call cmd deletion callbacks. check-in2013-08-14 17:02:41
dgpplain2013-08-14 16:35:20
New test:

test rename-4.8 {Bug a16752c252} testdel {
    set x broken
    testdel {} foo {set x ok}
    proc foo args {}
    rename foo {}
    return -level 0 $x[unset x]
} ok
dgpplain2013-08-14 17:04:35
Fixed for 8.5.15 and 8.6.1.
jan.nijtmanswiki2019-03-24 17:45:06

Also see ammendement commit [d041733320ea01c2], in which a special exception is made to this bug-fix.

Log in (anonymous is fine) to add a comment.