From 86460616271743970d1ffb2f64ee671e3deeb4cc Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 18 Jan 2023 04:35:01 +0100 Subject: MacOSXCGLContext: Avoid data race on lastSetNSViewCmd, use local copy like in madeCurrent --- src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java') diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 2c200b664..b577d8639 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -1052,9 +1052,10 @@ public class MacOSXCGLContext extends GLContextImpl OSXUtil.RunOnMainThread(false /* wait */, false /* kickNSApp */, cmd); } final boolean lockCGLContext; - if( null != lastSetNSViewCmd ) { - synchronized( lastSetNSViewCmd ) { - lockCGLContext = lastSetNSViewCmd.done; + final SetNSViewCmd _lastSetNSViewCmd = lastSetNSViewCmd; + if( null != _lastSetNSViewCmd ) { + synchronized( _lastSetNSViewCmd ) { + lockCGLContext = _lastSetNSViewCmd.done; if( lockCGLContext ) { lastSetNSViewCmd = null; // done, no more required } else if( DEBUG1398 ) { -- cgit v1.2.3