Merge pull request #6485 from deathbeam/gpu-null-check

Null-check GL and window on plugin shutdown
This commit is contained in:
Tomas Slusny
2018-11-20 10:36:43 +01:00
committed by GitHub

View File

@@ -319,6 +319,11 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
protected void shutDown() protected void shutDown()
{ {
clientThread.invoke(() -> clientThread.invoke(() ->
{
client.setGpu(false);
client.setDrawCallbacks(null);
if (gl != null)
{ {
if (textureArrayId != -1) if (textureArrayId != -1)
{ {
@@ -326,9 +331,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
textureArrayId = -1; textureArrayId = -1;
} }
client.setGpu(false);
client.setDrawCallbacks(null);
if (bufferId != -1) if (bufferId != -1)
{ {
GLUtil.glDeleteBuffer(gl, bufferId); GLUtil.glDeleteBuffer(gl, bufferId);
@@ -357,7 +359,12 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
} }
glContext.destroy(); glContext.destroy();
}
if (jawtWindow != null)
{
NewtFactoryAWT.destroyNativeWindow(jawtWindow); NewtFactoryAWT.destroyNativeWindow(jawtWindow);
}
jawtWindow = null; jawtWindow = null;
gl = null; gl = null;