Tcl Source Code

View Ticket
Login
Ticket UUID: 3b9b6e7d08810a5d0f71dc53d92a3e5c809d68ad
Title: Tcl_SetNotifier on Mac causes Tcl to crash
Type: Bug Version: 8.5.14 and 8.6.0, probably in all recent versions
Submitter: anonymous Created on: 2013-09-15 06:48:28
Subsystem: 01. Notifier Assigned To: kevin_walzer
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2013-11-12 14:40:29
Resolution: Invalid Closed By: dkf
    Closed on: 2013-11-12 14:40:29
Description:
In macosx/tclMacOSXNotify.c, Tcl_Sleep makes use of the local ThreadSpecificData *tsdPtr, which is effectively private data belonging to the notifier. However, Tcl_Sleep itself is not part of the notifier. If I then use Tcl_SetNotifier to replace the notifier, then Tcl crashes because Tcl_Sleep still tries to use the original notifier, which has not been initialized (so tsdPtr is invalid). The solution to this bug is to either include Tcl_Sleep in the notifier (i.e., in Tcl_NotifierProcs), or rewrite Tcl_Sleep on Mac OS X such that it does not use data private to the notifier.
User Comments: jan.nijtmans added on 2013-09-15 21:57:48:
Actually, I think this bug report is invalid. tsdPtr is always initialized,
if it wasn't already then the TCL_TSD_INIT(&dataKey) in Tcl_Sleep will
do it. Further on, the Tcl_Sleep function properly tests for tsdPtr->runLoop
and tsdPtr->runLoopTimer being non-NULL before using them. 

I would really like to have a look at a stack-trace first, before doing anything here. It's more likely that the replacement notifier does something wrong.

jan.nijtmans added on 2013-09-15 21:33:09:
The Tcl_Sleep() function was added in the MacOSX
Notifier in [7a6749806adf6447], just before
the release of 8.5.7. It appears that 8.5.6
worked correctly.

dgp added on 2013-09-15 19:49:27:
Is this a regression?  If so, what was the last
release of Tcl that worked correctly?