Tcl Source Code

View Ticket
Login
Ticket UUID: 6bdadfba7de3f9a8881e1ca4726f3c7fb8d5da17
Title: Traces crash with multi-lappend
Type: Bug Version: 8.6
Submitter: dkf Created on: 2019-06-20 19:40:00
Subsystem: 47. Bytecode Compiler Assigned To: dkf
Priority: 9 Immediate Severity: Severe
Status: Closed Last Modified: 2023-03-24 21:35:46
Resolution: Fixed Closed By: pooryorick
    Closed on: 2023-03-24 21:35:46
Description: (text/html)
This script crashes. It shouldn't.
<pre>
    set x 1
    lappend x 2 3
    set y $x
    trace add variable x write {apply {args {error boo}}}
    lappend x 4 5
</pre>
User Comments: pooryorick added on 2023-03-24 21:35:46: (text/x-fossil-wiki)
This was a simple programming error, not anything related to elaborate refCounting.

pooryorick added on 2023-03-21 23:54:36: (text/x-fossil-wiki)
Commit [c0778ccb77b7d096] removes the unneeded calls to Tcl_IncrRefCount() and TclDecrRefCount() from the fix. TclPtrSetVarIdx() takes ownership of newValuePtr if its refCount is 0, and either stores or frees it.

pooryorick added on 2023-03-21 16:53:51: (text/x-fossil-wiki)
Fixed by dkf in [ca4a6f0a9595ac1f].