AWTGLCanvas: Make sure we don't paint while destroying the canvas

This commit is contained in:
Elias Naur 2006-11-10 11:44:00 +00:00
parent c0248a7ee4
commit 216044ffa4
1 changed files with 6 additions and 2 deletions

View File

@ -191,8 +191,10 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
* @see java.awt.Component#removeNotify() * @see java.awt.Component#removeNotify()
*/ */
public void removeNotify() { public void removeNotify() {
destroyContext(); synchronized (SYNC_LOCK) {
super.removeNotify(); destroyContext();
super.removeNotify();
}
} }
/** /**
@ -284,6 +286,8 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
*/ */
public final void paint(Graphics g) { public final void paint(Graphics g) {
synchronized (SYNC_LOCK) { synchronized (SYNC_LOCK) {
if (!isDisplayable())
return;
try { try {
if (peer_info == null) { if (peer_info == null) {
this.peer_info = implementation.createPeerInfo(this, pixel_format); this.peer_info = implementation.createPeerInfo(this, pixel_format);