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()
*/
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);