當前位置:首頁 > IT技術(shù) > 編程語言 > 正文

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
  • 參考網(wǎng)頁

  搜索了一下,說JDK242正常,252出現(xiàn)的問題。

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

  吾試了一下,使用官方發(fā)布的JDK202確實是可以的。由錯誤變成了警告。下載鏈接:

Java Archive | Oracle

  • ?原因分析

  對比老新版本的JDK輸出,由Warning變成了Error。說明JDK本身沒有變化,變化的是Xcode版本(新版本要求必須在主線程進行某些操作)。而其他軟件沒有及時跟進,于是出錯了。

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

開通會員,享受整站包年服務立即開通 >