From 70c096c01fb666844adbd488e3309830ddd0ba1a Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 15 Nov 2004 20:21:06 +0000 Subject: Fixed Issue 119: Dual-head problems on Windows XP Added needed synchronization around creation of dummy windows for wglChoosePixelFormatARB calls. Fixed race condition in StaticGLInfo initialization. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@170 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java | 5 ++--- src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/net') diff --git a/src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java b/src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java index ed0c83445..338ae1d3f 100644 --- a/src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/net/java/games/gluegen/opengl/BuildStaticGLInfo.java @@ -196,7 +196,7 @@ public class BuildStaticGLInfo output.println(" // maps function names to the extension string or OpenGL"); output.println(" // specification version string to which they correspond."); - output.println(" private static HashMap funcToAssocMap = null;"); + output.println(" private static HashMap funcToAssocMap;"); output.println(); output.println(" /**"); @@ -221,12 +221,11 @@ public class BuildStaticGLInfo output.println(" */"); output.println(" public static String getFunctionAssociation(String glFunctionName)"); output.println(" {"); - output.println(" if (funcToAssocMap == null) { init(); }"); output.println(" return (String)funcToAssocMap.get(glFunctionName);"); output.println(" }"); output.println(); - output.println(" private static void init()"); + output.println(" static"); output.println(" {"); output.println(" funcToAssocMap = new HashMap(1536); // approximate max capacity"); output.println(" String group;"); diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java b/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java index a4f588158..726091bf1 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java +++ b/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java @@ -263,7 +263,9 @@ public class WindowsGLContextFactory extends GLContextFactory { public void run() { // Create a native window and device context - HWND = WGL.CreateDummyWindow( rectangle.x, rectangle.y, rectangle.width, rectangle.height ); + synchronized (WindowsGLContextFactory.class) { + HWND = WGL.CreateDummyWindow( rectangle.x, rectangle.y, rectangle.width, rectangle.height ); + } HDC = WGL.GetDC( HWND ); // Start the message pump at shutdown -- cgit v1.2.3