当前位置:首页 > IT技术 > 编程语言 > 正文

JDK/JAVA Exception NSWindow drag regions should only be invalidated on the Main Thread
2022-02-14 10:40:50

  • 在MAC 11上运行jogmap,报错:
2022-01-24 10:56:37.395 java[94984:1325231] Apple AWT Internal Exception: NSWindow drag regions should only be invalidated on the Main Thread!
2022-01-24 10:56:37.395 java[94984:1325231] *** 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                      0x00007fff2062a1db __exceptionPreprocess + 242
  1   libobjc.A.dylib                     0x00007fff20363d92 objc_exception_throw + 48
  2   CoreFoundation                      0x00007fff206528e6 -[NSException raise] + 9
  3   AppKit                              0x00007fff22de1eb2 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 321
  4   AppKit                              0x00007fff22dccaa2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1296
  5   AppKit                              0x00007fff22dcc58b -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
  6   libnativewindow_macosx.jnilib       0x00000001b2269502 Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 354
  7   ???                                 0x000000011937caa8 0x0 + 4718054056
)
libc++abi: terminating with uncaught exception of type NSException
  • 参考网页

  搜索了一下,说JDK242正常,252出现的问题。

java - Apple AWT Internal Exception: NSWindow drag regions should only be invalidated on the Main Thread - Stack Overflow

  吾试了一下,使用官方发布的JDK202确实是可以的。由错误变成了警告。下载链接:

Java Archive | Oracle

  •  原因分析

  对比老新版本的JDK输出,由Warning变成了Error。说明JDK本身没有变化,变化的是Xcode版本(新版本要求必须在主线程进行某些操作)。而其他软件没有及时跟进,于是出错了。

本文摘自 :https://blog.51cto.com/u

开通会员,享受整站包年服务立即开通 >