From d281f8848cb12f9e8578777be866ef7eb9284aa0 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 30 May 2006 12:41:49 +0000 Subject: [PATCH] Change AWTGLCanvas paint() to make current and release the context to avoid problems with different AWT event threads calling paint() --- src/java/org/lwjgl/opengl/AWTGLCanvas.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/java/org/lwjgl/opengl/AWTGLCanvas.java b/src/java/org/lwjgl/opengl/AWTGLCanvas.java index 4e27ebe4..17b510e9 100644 --- a/src/java/org/lwjgl/opengl/AWTGLCanvas.java +++ b/src/java/org/lwjgl/opengl/AWTGLCanvas.java @@ -270,13 +270,16 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, context.makeCurrent(); initGL(); } - if (!context.isCurrent()) - context.makeCurrent(); - if (update_context) { - context.update(); - update_context = false; + context.makeCurrent(); + try { + if (update_context) { + context.update(); + update_context = false; + } + paintGL(); + } finally { + Context.releaseCurrentContext(); } - paintGL(); } finally { peer_info.unlock(); }