Resize and context thread

Hello all ! I’m using GLJPanel and the RC8 version of JOGL.

My GLJPanel is embedded in a Swing application. When I resize the frame the GLJPanel is resized and repaint, normal.

My display is controlled by a scheduler, which execute as much as possible tasks in a parallel way and finally call the real display(). Actually one of these tasks is calculate the frustum and require the OpenGL thread to be able to enter in OpenGL Select mode. Because these tasks are executed in threads, the context is makeCurrent before the tasks start and is release at the end. Concerning the display thread it release the context before the tasks start and makeCurrent again after they end.

When I resize very fast my Frame I experience an Exception Context not current on current thread. It happend when I try to release the context from the display thread (hence before the compute frustum task.)

I assume when you rezise fast the frame, severals events are created and so several calls to paint follow. I assume because the task thread can be started severals times without the time to finish, the context thread could be still on the task thread when the next paint call will try to release it.

How do you think I can handle this problem ?

Thank you.