From 216044ffa453ef4e97ab773f3683662d0d351c05 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 10 Nov 2006 11:44:00 +0000 Subject: [PATCH] AWTGLCanvas: Make sure we don't paint while destroying the canvas --- src/java/org/lwjgl/opengl/AWTGLCanvas.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java/org/lwjgl/opengl/AWTGLCanvas.java b/src/java/org/lwjgl/opengl/AWTGLCanvas.java index 991339bd..0bbf590f 100644 --- a/src/java/org/lwjgl/opengl/AWTGLCanvas.java +++ b/src/java/org/lwjgl/opengl/AWTGLCanvas.java @@ -191,8 +191,10 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, * @see java.awt.Component#removeNotify() */ public void removeNotify() { - destroyContext(); - super.removeNotify(); + synchronized (SYNC_LOCK) { + destroyContext(); + super.removeNotify(); + } } /** @@ -284,6 +286,8 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, */ public final void paint(Graphics g) { synchronized (SYNC_LOCK) { + if (!isDisplayable()) + return; try { if (peer_info == null) { this.peer_info = implementation.createPeerInfo(this, pixel_format);