When I start wish on OSX from a session that does not have access to the window server (for instance using an SSH connection as a user that is not logged on on the console) I get a hard crash due to an uncaught ObjC exception:
Sun May 16 11:30:39 Rivendell.local Wish[37073] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
% 2010-05-16 11:30:39.691 Wish[37073:903] setCanCycle: is deprecated. Please use setCollectionBehavior instead
2010-05-16 11:30:39.704 Wish[37073:903] An uncaught exception was raised
2010-05-16 11:30:39.704 Wish[37073:903] Error (1002) creating CGSWindow
2010-05-16 11:30:39.705 Wish[37073:903] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff85e31d24 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff860000f3 objc_exception_throw + 45
2 CoreFoundation 0x00007fff85e31b47 +[NSException raise:format:arguments:] + 103
3 CoreFoundation 0x00007fff85e31ad4 +[NSException raise:format:] + 148
4 AppKit 0x00007fff84614aba _NSCreateWindowWithOpaqueShape2 + 473
5 AppKit 0x00007fff845a9055 -[NSWindow _commonAwake] + 1214
6 AppKit 0x00007fff845c6d3d -[NSWindow _makeKeyRegardlessOfVisibility] + 96
7 AppKit 0x00007fff845c6cb2 -[NSWindow makeKeyAndOrderFront:] + 24
8 Tk 0x00000001000c435a XMapWindow + 139
9 Tk 0x0000000100032d3c Tk_MapWindow + 84
10 Tk 0x000000010003db5f TkCreateFrame + 1869
11 Tcl 0x00000001001eec9c TclServiceIdle + 76
12 Tcl 0x00000001001d531d Tcl_DoOneEvent + 340
13 Tk 0x000000010001af93 Tk_MainLoop + 29
14 Tk 0x0000000100027257 Tk_MainEx + 1589
15 Wish 0x00000001000044fe 0x0 + 4294984958
16 Wish 0x00000001000044ac 0x0 + 4294984876
)
terminate called after throwing an instance of 'NSException'
Abort trap
I'd expect to get a Tcl error instead of a hard abort.
This also affects embedders of Tcl/Tk, the reason I post this issue is the following issue in the Python tracker: <http://bugs.python.org/issue8716>. I'm looking for a workaround for that issue (because we'll have to work with system versions of Tk) but it would be nice if this were fixed upstreams as well.