Properly close GL context and lock surface

- Context can be created without GL being assigned (e.g in case version
is not supported)
- We need to lock jawtWindow if it is not locked always in case it is
not null, and not only when GL is set

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-11-23 13:30:46 +00:00
parent ef567e364f
commit ce6bd7e3f4

View File

@@ -368,17 +368,20 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
shutdownProgram(); shutdownProgram();
shutdownVao(); shutdownVao();
shutdownStretchedFbo(); shutdownStretchedFbo();
}
if (jawtWindow != null)
{
if (!jawtWindow.getLock().isLocked()) if (!jawtWindow.getLock().isLocked())
{ {
jawtWindow.lockSurface(); jawtWindow.lockSurface();
} }
glContext.destroy(); if (glContext != null)
} {
glContext.destroy();
}
if (jawtWindow != null)
{
NewtFactoryAWT.destroyNativeWindow(jawtWindow); NewtFactoryAWT.destroyNativeWindow(jawtWindow);
} }