Tk Source Code

View Ticket
Login
Ticket UUID: be9cade996ff6489939bd83dce2f44aff80964d5
Title: sigsegv in tkwait
Type: Bug Version: 8.6.11
Submitter: anonymous Created on: 2021-02-17 10:28:20
Subsystem: 69. Events Assigned To: fvogel
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2021-02-25 10:46:31
Resolution: Fixed Closed By: fvogel
    Closed on: 2021-02-25 10:46:31
Description:
Hi,

Following code produces sigsegv in tk8.6.11.

namespace eval dialog {
  variable WaitButton ""

  proc show {ths} {
    variable WaitButton
    variable this

    set this $ths
    toplevel $this
    bind $this <Destroy> "variable [namespace current]::WaitButton destroyed
    namespace delete dialog"

    wm geometry $this [format "+%d+%d" 100 100]
    wm deiconify $this

    tkwait variable [namespace current]::WaitButton
    return $WaitButton
  }
}

set w [dialog::show .test]

after launching script with wish, click on close (X) button of window. closing window throws sigsegv.

vwait had the same issue and it was fixed few years back, probably same fix is needed for tkwait.

ticket for vwait issue: https://core.tcl-lang.org/tcl/tktview/16828b3744521541660af48501fa06e63e564ad3

Platform details: 

cat /etc/redhat-release 
CentOS release 6.10 (Final)

echo 'puts [info patchlevel]; parray tcl_platform;exit 0' | ./wish8.6
8.6.11
tcl_platform(byteOrder)     = littleEndian
tcl_platform(engine)        = Tcl
tcl_platform(machine)       = x86_64
tcl_platform(os)            = Linux
tcl_platform(osVersion)     = 5.4.88-1.x86_64
tcl_platform(pathSeparator) = :
tcl_platform(platform)      = unix
tcl_platform(pointerSize)   = 8
tcl_platform(threaded)      = 1
tcl_platform(user)          = user1
tcl_platform(wordSize)      = 8



crash happen in tkCmds.c:WaitVariableProc function, when this function is called *donePtr = 1; statement causes program counter corruption hence no callstack is seen in gdb.
User Comments: fvogel added on 2021-02-25 10:46:31:
I would have loved to write a non regression test for this ticket, as it was done for the ticket regarding vwait in Tcl. That's why I has assigned this ticket to me and had kept it open. Sigh.

jan.nijtmans added on 2021-02-25 10:28:01:

I don't think there's anything more to do with this ticket, so I am taking the freedom to merge it to core-8-6-branch and up. Thanks, Michael and François!


jan.nijtmans added on 2021-02-25 07:35:00:

LGTM! Thanks, François for handling this!


fvogel added on 2021-02-20 14:15:22:

Many thanks for your clear bug report, demo script, and correct reference to the issue in vwait.

I can reproduce with Linux Debian 10.

Following the ticket in Tcl for vwait, when I introduce the same fix in tkwait as for vwait the crash is gone. See [fda7fe5d].


marc_culler (claiming to be Marc Culler) added on 2021-02-18 13:52:19:
I ran this script on macOS 11.2 using the tip of core-8-6-branch.
There was no segfault.

Maybe it would be helpful if you were to provide more details about the
environment in which the segfault was observed, such as the operating
system.