macOS Sierra 10.12: Error on initializing Display with swt 4.6 [message #1744654] |
Thu, 29 September 2016 10:17 |
Peter Probst Messages: 2 Registered: September 2016 |
Junior Member |
|
|
Hi all,
on sierra we are facing an error while getting the display component from swt. Code that is working formerly from 10.8 to 10.11 without problems is now causing a system error on macOS. The annoying thing is the fact, that we can not catch and supress the error, the initialization seems to run decoupled from our calling thread. Although the functionality of the display class is usable after the error (in our case), the user is facing a macOS Error Message Box which has to be additionally clicked (and worse, there is the ability to crash and stop the app).
We are using latest binary org.eclipse.swt.cocoa.macosx.x86_64:4.6 on oracle jdk 1.8.0_102
Here is the initialization code for mac:
Class<?> comAppleConcurrentDispatch = null;
try {
comAppleConcurrentDispatch = Class.forName("com.apple.concurrent.Dispatch");
Method getInstance = comAppleConcurrentDispatch.getMethod("getInstance", (Class<?>[])null);
Object dispatchInstance = getInstance.invoke(null, (Object[])null);
Method getNonBlockingMainQueueExecutor = dispatchInstance.getClass().getMethod("getNonBlockingMainQueueExecutor", (Class<?>[])null);
Executor executor = (Executor)getNonBlockingMainQueueExecutor.invoke(dispatchInstance, (Object[])null);
executor.execute(new Runnable() {
public void run() {
try {
display = new Display();
shell = new Shell(display, SWT.SHELL_TRIM | SWT.ON_TOP);
} catch (Throwable t) {
log.error("Can not create Shell", t);
}
}
});
} catch (Throwable t) {
log.error("Can not create Shell", t);
}
The Problem occurs on display = new Display(); The catch is not triggered.
The OS bubbles up the following message:
Exception Name: NSInvalidArgumentException
Description: _createMenuRef called with existing principal MenuRef already associated with menu
User Info: (null)
0 CoreFoundation 0x00007fffb8f907bb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffcd6fda2a objc_exception_throw + 48
2 CoreFoundation 0x00007fffb900da65 +[NSException raise:format:] + 197
3 AppKit 0x00007fffb6b9606f -[NSCarbonMenuImpl _createMenuRef] + 62
4 AppKit 0x00007fffb6b959b6 -[NSCarbonMenuImpl _instantiateCarbonMenu] + 140
5 AppKit 0x00007fffb6b9346a -[NSApplication finishLaunching] + 825
6 libosxapp.dylib 0x00000001216e9e5a -[NSApplicationAWT finishLaunching] + 683
7 libswt-pi-cocoa-4623.jnilib 0x000000012629eab6 Java_org_eclipse_swt_internal_cocoa_OS_objc_1msgSendSuper__Lorg_eclipse_swt_internal_cocoa_objc_1super_2J + 89
8 ??? 0x000000010a7abe64 0x0 + 4470783588
We have filed a bug on https://bugs.eclipse.org/bugs/show_bug.cgi?id=502538
Is there any workaround for this situation? Any help is welcome.
Thanks, Peter
|
|
|
|
Powered by
FUDForum. Page generated in 0.01463 seconds