Bug 1370 - NSWindow drag regions should only be invalidated on the Main Thread!
Summary: NSWindow drag regions should only be invalidated on the Main Thread!
Status: RESOLVED FIXED
Alias: None
Product: Nativewindow
Classification: JogAmp
Component: macosx (show other bugs)
Version: 2.4.0
Hardware: All macosx
: P2 critical
Assignee: Sven Gothel
URL:
Depends on:
Blocks: 1393 1372
  Show dependency treegraph
 
Reported: 2019-04-04 17:10 CEST by Sven Gothel
Modified: 2019-09-09 09:52 CEST (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
jogl 1c697274a3c1e976bd9c9b089d6583edf4f346ae
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2019-04-04 17:10:23 CEST
On OSX 10.14.3 Mojave, we get the following warning:

+++
2019-04-04 17:01:23.778 java[4098:282573] WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future. Called from (
    0   AppKit                              0x00007fff4139cccc -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 386
    1   AppKit                              0x00007fff4139a07c -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1488
    2   AppKit                              0x00007fff41399aa6 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
    3   libnativewindow_macosx.dylib        0x0000000119da7509 Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 377
    4   ???                                 0x000000011aff1667 0x0 + 4747892327
)
+++

Investigate and resolve this issue.
Comment 1 Sven Gothel 2019-04-05 00:46:54 CEST
We may consider this tool here https://developer.apple.com/documentation/code_diagnostics/main_thread_checker

as found in a comment on this SDL thread: https://discourse.libsdl.org/t/crash-on-macos-10-14-mojave-with-sdl-showmessagebox/25100

+++

The Jaamsim group has also encountered this issues, which I found by duck duck go'ing the warning ;-)
https://groups.google.com/d/topic/jaamsim-users/JGqmj9CRXcU/discussion
Comment 2 Sven Gothel 2019-04-05 05:56:49 CEST
Call from Main-Thread: NW's OSXUtil.CreateNSWindow0(..) and NEWT's WindowDriver.createWindow0(..)
    
OSX 10.14.3 Mojave issues a WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future.
    
The complaint about NativeWindow (NW)'s OSXUtil.CreateNSWindow0(..)
might be valid, which does create a NS Window instance w/ NSView and framebuffer initialized.
    
However, the complaint about NEWT's WindowDriver.createWindow0(..)
is not, since the initialization incl framebuffer happened later
on the main thread.
    
Regardless, encapsulated both construction fully to run on the Main-Thread.
    
+++
    
Originally the Main-Thread design spec was like:
Must run on Main-Thread when or after making visible.
    
+++

Locally run all test on OSX 10.14.4 (another Mojave update)
with jdk1.8.0_192.jdk: all tests passed.