From 7a352d3747233be44edb4333da108228ca75f0f3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 22 Jan 2023 07:04:11 +0100 Subject: Workaround MacOS + SWT 4.26: java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.internal.cocoa.NSGraphicsContext.saveGraphicsState()" because "context" is null On MacOS 12+ and SWT 4.26 while not using AWT (-Djava.awt.headless=true, -XstartOnFirstThread), we recently get the following Exception from SWT (suppressed): java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.internal.cocoa.NSGraphicsContext.saveGraphicsState()" because "context" is null at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:764) at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:170) at org.eclipse.swt.widgets.Display.windowProc(Display.java:6287) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5565) at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5965) 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:3983) at com.jogamp.opengl.test.junit.util.SWTTestUtil$WaitAction$1.run(SWTTestUtil.java:52) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:183) at org.eclipse.swt.widgets.Display.syncExec(Display.java:5250) at com.jogamp.opengl.test.junit.util.SWTTestUtil$WaitAction.run(SWTTestUtil.java:63) at com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3.test02AsyncEachAnimator(TestSharedContextVBOES2SWT3.java:376) This is not observed if running using AWT (-Djava.awt.headless=false). --- make/scripts/tests.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'make/scripts') diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index cbc394bc5..c24ac43fe 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -965,10 +965,15 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas $* #testawt com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot $* -testswt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $* +# On MacOS 12+ and SWT 4.26 while not using AWT (-Djava.awt.headless=true, -XstartOnFirstThread), +# we recently get the following Exception from SWT (suppressed): +# java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.internal.cocoa.NSGraphicsContext.saveGraphicsState()" because "context" is null +# +# This is not observed if running using AWT (-Djava.awt.headless=false). +# #testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $* -#testswt com.jogamp.opengl.test.junit.jogl.swt.TestGLCanvasSWTNewtCanvasSWTPosInTabs $* -#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTBug643AsyncExec $* +#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $* +testswt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $* # # to re-test: -- cgit v1.2.3