ruby / ruby/tk

Ruby crashes during `require "tk"` on Mac OS 15

Open
#64 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
137
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I am on Mac OS 15.2 M2, using Ruby 3.4.1 which is installed from chruby, and it seems that #33 has reappeared:

irb(main):001> require "tk"
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow should only be instantiated on the main thread!'
*** First throw call stack:
(
        0   CoreFoundation                      0x000000018df12e80 __exceptionPreprocess + 176
        1   libobjc.A.dylib                     0x000000018d9facd8 objc_exception_throw + 88
        2   CoreFoundation                      0x000000018df37534 _CFBundleGetValueForInfoKey + 0
        3   AppKit                              0x0000000191a1ac4c -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 260
        4   AppKit                              0x0000000191a1ab3c -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48
        5   libtk8.6.dylib                      0x0000000127b0bb5c TkMacOSXMakeRealWindowExist + 496
        6   libtk8.6.dylib                      0x0000000127b0b85c TkWmMapWindow + 56
        7   libtk8.6.dylib                      0x0000000127a7cffc MapFrame + 76
        8   libtcl8.6.dylib                     0x000000012784450c TclServiceIdle + 84
        9   libtcl8.6.dylib                     0x0000000127828660 Tcl_DoOneEvent + 296
        10  libtk8.6.dylib                      0x0000000127aff81c TkpInit + 712
        11  libtk8.6.dylib                      0x0000000127a76030 Initialize + 2372
        12  tcltklib.bundle                     0x00000001273b0584 ruby_tk_stubs_init + 12
        13  tcltklib.bundle                     0x00000001273b4a08 ip_init + 852
        14  ruby                                0x0000000104e41aec vm_call_cfunc_with_frame_ + 240
        15  ruby                                0x0000000104e25d64 vm_exec_core + 9248
        16  ruby                                0x0000000104e22430 rb_vm_exec + 492
        17  ruby                                0x0000000104e48398 rb_call0 + 888
        18  ruby                                0x0000000104d1d574 rb_class_new_instance_pass_kw + 64
        19  ruby                                0x0000000104e41aec vm_call_cfunc_with_frame_ + 240
        20  ruby                                0x0000000104e25d64 vm_exec_core + 9248
        21  ruby                                0x0000000104e22430 rb_vm_exec + 492
        22  ruby                                0x0000000104e368c4 vm_invoke_proc + 712
        23  ruby                                0x0000000104df68f0 thread_do_start_proc + 668
        24  ruby                                0x0000000104df5fbc thread_start_func_2 + 796
        25  ruby                                0x0000000104df5b38 nt_start + 248
        26  libsystem_pthread.dylib             0x000000018ddb82e4 _pthread_start + 136
        27  libsystem_pthread.dylib             0x000000018ddb30fc thread_start + 8
)
libc++abi: terminating due to uncaught exception of type NSException
[1]    39903 abort      irb

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing require "tk" in irb on Mac OS 15.2 with Ruby 3.4.1, then compare the behavior with issue #33. Trace the initialization path through tcltklib.bundle and the libtk8.6.dylib stack frames; done means requiring tk no longer terminates Ruby on the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.