Tcl Source Code

View Ticket
Login
2026-11-01
20:39 • Ticket [b4637c4312] upvar segfault for destroyed object status still Closed ... artifact: c4d85129c8 user: dkf
20:38 • Closed ticket [b4637c4312]. artifact: e3b52dc75a user: dkf
20:36
Fix [28de60cef5] and [b4637c4312] check-in: f3f08274f7 user: dkf tags: trunk, main
20:30
Fix [28de60cef5] and [b4637c4312] check-in: 298d1d97d5 user: dkf tags: core-9-0-branch
20:11
Backport of Fix [b4637c4312]: [upvar] to an object variable after the object was destroyed in its me... check-in: eed1c88593 user: dkf tags: oo-destructor-deleted-namespace-90
17:42 • Ticket [b4637c4312] upvar segfault for destroyed object status still Open wi... artifact: d80dd4c630 user: dkf
2026-10-13
19:08 • Ticket [b4637c4312]: 4 changes artifact: 42f3dc584f user: serhiy.storchaka
19:06
Fix [b4637c4312]: [upvar] to an object variable after the object was destroyed in its method crashed... closed check-in: de6527681f user: serhiy.storchaka tags: oo-destructor-deleted-namespace
2025-05-08
09:31 • New ticket [b4637c4312] upvar segfault for destroyed object. artifact: 0e8b900f7d user: ooa64_ua_fm

Ticket UUID: b4637c4312a59ca57ef8148623f973a7493e950a
Title: upvar segfault for destroyed object
Type: Bug Created on: 2025-05-08 09:31:31
Submitter: ooa64_ua_fm Assigned to: dkf
Subsystem: 35. TclOO Package Severity: Severe
Priority: 5 Medium Last modified: 2026-11-01 20:39:55
Status: Closed Closed by: dkf
Resolution: Fixed Closed on: 2026-11-01 20:39:55
Version: 8.6.18, 9.0.5, 9.1.0
Description:
This script crashes tcl interpreter (segmentation fault on linux or silent crash on windows):
---
proc crash {varname} {
    upvar $varname V ;# <<<< crashes here !!!
}

oo::class create C {
    variable V
    method run {} {
        my destroy
        crash V
    }
}

C create c
c run
---

Trying on:
windows tcl 8.6.16, 9.0.2
linux tcl 8.6.12
https://onecompiler.com/tcl 8.6.14
User Comments:
serhiy.storchaka added on 2026-10-13 19:08:05:

Same cause as [28de60cef5]: after [my destroy] the namespace of the object is deleted, and resolving V for upvar in the method looked it up there. It also crashes with 8.6.17, 9.0 and 9.1.

Proposed fix in branch oo-destructor-deleted-namespace: the script returns normally, and V is a new unset variable. Test oo-3.14.


dkf added on 2026-11-01 17:42:58:

Confirming the crash with 9.1.0, and it looks like something that wants a backport fix to 9.0 too.

No plans to backport to 8.6, given the support status of that release line.


dkf added on 2026-11-01 20:38:45:

Fix applied to 9.0 onwards.


dkf added on 2026-11-01 20:39:55:

BTW, thanks for hunting this down, Serhiy.