I'm trying to debug a segfault in Tk 8.5/Fossil on OS X Lion, and am
having difficulty.
After stepping through gdb, I trace the error to this backtrace:
0x0000000100176d5a in Tk_MacOSXSetupTkNotifier () at tkMacOSXNotify.c:167
After some logging of various commands, it appears that Wish is crashing
on this call, in tkMacOSXNotify.c:
TclMacOSXNotifierAddRunLoopMode(NSEventTrackingRunLoopMode);
Poking around further, I find this function defined in tclMacOSXNotify.c:
void
TclMacOSXNotifierAddRunLoopMode(
const void *runLoopMode)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
CFStringRef mode = (CFStringRef) runLoopMode;
if (tsdPtr->runLoop) {
CFRunLoopAddSource(tsdPtr->runLoop, tsdPtr->runLoopSource, mode);
CFRunLoopAddObserver(tsdPtr->runLoop, tsdPtr->runLoopObserver, mode);
if (tsdPtr->runLoopTimer) {
CFRunLoopAddTimer(tsdPtr->runLoop, tsdPtr->runLoopTimer, mode);
}
}
}
It appears that the pointer address &dataKey is null, which causes the
crash. dataKey is defined at the beginning of the file, thus:
static Tcl_ThreadDataKey dataKey;
and is used throughout the tclMacOSXNotify.c file.
I can't figure out why the memory is being corrupted as this code has
worked fine, until very recently, and this particular file hasn't been
touched in a long time. Any suggestions as to what strategies I can
employ to investigate this further?
--Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com