Summary: | [macOS][BigSur] NPE error when initialize GLCanvas object. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Stella Ma <stellama> | ||||||
Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||||
Status: | NEW --- | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | a.nesheret, alexis.drogoul, biguphpc, brianhsu.hsu, lshanmug, mariomarinato | ||||||
Version: | 4.18 | ||||||||
Target Milestone: | --- | ||||||||
Hardware: | PC | ||||||||
OS: | Mac OS X | ||||||||
Whiteboard: | |||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 575659, 569361 | ||||||||
Attachments: |
|
Description
Stella Ma
2021-01-25 21:35:43 EST
I have a similar situation here, using Eclipse 4.19 (2021-03) on Big Sur. The error pops up when I call Display.readAndDispatch() on my event loop: while ( !myShell.isDisposed() ) { if ( !display.readAndDispatch() ) display.sleep(); } } This is the error I get. The stack is a bit different, but the NPE is at the same Widget.java:763 line. java.lang.NullPointerException at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:763) at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:170) at org.eclipse.swt.widgets.Display.windowProc(Display.java:6046) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5315) at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5719) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:92) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3831) at mjCanvas.MJCanvas.main(MJCanvas.java:57) (I feel I must add that Big Sur is major nightmare. Lot's of problems on the RCP we develop.) Same here. Using Eclipse 4.19, on Big Sur, together with JOGL (which creates its own canvas). The stack I systematically obtain is: Closing msi.gama.application.view.InteractiveConsoleView java.lang.NullPointerException at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:763) at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:170) at org.eclipse.swt.widgets.Display.windowProc(Display.java:6046) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5315) at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5719) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:92) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3831) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156) at msi.gama.application.Application.start(Application.java:143) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1461) at org.eclipse.equinox.launcher.Main.main(Main.java:1434) So a bit different, of course, but it seems that SWT/macOS is unable to create a (or pass a valid) graphics context. Can you please provide a snippet to reproduce the problem? Created attachment 286470 [details] Snippet that reproduces the bug There you go, a snippet. Comment / uncomment lines 33 and 36 to see the difference in behavior. This same snippet can be used to reproduce Bug 573782. Created attachment 288245 [details]
Snippet to reproduce this bug.
I could also reproduce this bug at MacOS Monterey (12.0.1) with lwjgl-3.3.1 binding.
The problem is caused by line 20:
GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data);
If this line is removed, everything is fine.
Here is the stack trace:
[error] Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.internal.cocoa.NSGraphicsContext.saveGraphicsState()" because "context" is null
[error] at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:764)
[error] at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:170)
[error] at org.eclipse.swt.widgets.Display.windowProc(Display.java:6252)
[error] at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
[error] at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5530)
[error] at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5930)
[error] at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
[error] at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:92)
[error] at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3964)
[error] at example.Snippet1.main(Snippet1.java:27)
This bug has affected our product for more than a year and makes it impossible to use any OpenGL on OSX. Is there anything we can to to help get it fixed ? It's very easy to reproduce but I'm not familiar with SWT development. Thanks |