Skip to content

Ruby crashes during require 'tk' on macOS 10.14.6 (Mojave) #33

Description

@suetanvil

When I install the tk gem with gem install tk and then type require 'tk' into irb, the program crashes with the error message below. This appears to be due to a new limitation of the macOS GUI layer.

I am able to work around this by installing ActiveTcl 8.6 and then reinstalling the gem.

I am using Ruby 2.7.0 built from sources using rbenv.

I also attempted to work around this using the tcl-tk package provided by HomeBrew. I was not successful but it is possible I did not correctly specify the version of Tcl/Tk to use.

If you would like, I am willing to submit a pull request that updates the README.md and lists ActiveTcl as a dependency for macOS.

Backtrace follows:

2021-04-27 12:24:31.874 ruby[22997:225436] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff2c10eacd __exceptionPreprocess + 256
	1   libobjc.A.dylib                     0x00007fff56812a17 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff2c128629 -[NSException raise] + 9
	3   AppKit                              0x00007fff296cd5ca -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 317
	4   AppKit                              0x00007fff296ca9f7 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479
	5   AppKit                              0x00007fff296ca42a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
	6   Tk                                  0x00007fff37ea6eae TkMacOSXMakeRealWindowExist + 749
	7   Tk                                  0x00007fff37ea6aea TkWmMapWindow + 56
	8   Tk                                  0x00007fff37e19c05 Tk_MapWindow + 155
	9   Tk                                  0x00007fff37e21dae TkInstallFrameMenu + 267
	10  Tcl                                 0x00007fff37db6e7c TclServiceIdle + 75
	11  Tcl                                 0x00007fff37d9e4b9 Tcl_DoOneEvent + 344
	12  tcltklib.bundle                     0x000000010d2d2f20 call_DoOneEvent_core + 16
	13  tcltklib.bundle                     0x000000010d2d29fb tk_funcall + 427
	14  libruby.2.7.dylib                   0x0000000109716843 rb_protect + 339
	15  tcltklib.bundle                     0x000000010d2cb592 lib_eventloop_main_core + 642
	16  libruby.2.7.dylib                   0x00000001097169c0 rb_ensure + 240
	17  tcltklib.bundle                     0x000000010d2ceacd lib_mainloop + 173
	18  tcltklib.bundle                     0x000000010d2d1dd4 ip_mainloop + 180
	19  libruby.2.7.dylib                   0x00000001098c97c0 vm_call_cfunc + 368
	20  libruby.2.7.dylib                   0x00000001098af69f vm_exec_core + 14527
	21  libruby.2.7.dylib                   0x00000001098c45dc rb_vm_exec + 2780
	22  libruby.2.7.dylib                   0x000000010987f35e thread_do_start + 910
	23  libruby.2.7.dylib                   0x000000010987ecad thread_start_func_2 + 557
	24  libruby.2.7.dylib                   0x000000010987e89c thread_start_func_1 + 268
	25  libsystem_pthread.dylib             0x00007fff581d52eb _pthread_body + 126
	26  libsystem_pthread.dylib             0x00007fff581d8249 _pthread_start + 66
	27  libsystem_pthread.dylib             0x00007fff581d440d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
^CAbort trap: 6 (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions