Re: windowClosing causes GLCanvas to displose
Posted by
Demoscene Passivist on
Aug 28, 2010; 3:54pm
URL: https://forum.jogamp.org/windowClosing-causes-GLCanvas-to-displose-tp1380491p1380604.html
U are right this is indeed a strange behavior. Never noticed it myself.
After looking at the
GLCanvas sourcecode on Github the behavior became clear as there is an implicit closing listener registered when the display method is called on the GLCanvas.
public void display() {
maybeDoSingleThreadedWorkaround(displayOnEventDispatchThreadAction,
displayAction);
if(null==closingListener) {
synchronized(closingListenerLock) {
if(null==closingListener) {
closingListener=addClosingListener(this, new DestroyMethod() {
public void destroyMethod() { destroy(); } });
}
}
}
}
... don't know why this was done. Seems wrong to me but maybe theres a valid reason for this and Sven/Michael could shed light on this issue.
As a workaround for this issue I would suggest extending the GLCanvas and overriding the display method and remove the implicit closing listener registration.