Merge pull request #6485 from deathbeam/gpu-null-check
Null-check GL and window on plugin shutdown
This commit is contained in:
@@ -320,45 +320,52 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
|||||||
{
|
{
|
||||||
clientThread.invoke(() ->
|
clientThread.invoke(() ->
|
||||||
{
|
{
|
||||||
if (textureArrayId != -1)
|
|
||||||
{
|
|
||||||
textureManager.freeTextureArray(gl, textureArrayId);
|
|
||||||
textureArrayId = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
client.setGpu(false);
|
client.setGpu(false);
|
||||||
client.setDrawCallbacks(null);
|
client.setDrawCallbacks(null);
|
||||||
|
|
||||||
if (bufferId != -1)
|
if (gl != null)
|
||||||
{
|
{
|
||||||
GLUtil.glDeleteBuffer(gl, bufferId);
|
if (textureArrayId != -1)
|
||||||
bufferId = -1;
|
{
|
||||||
|
textureManager.freeTextureArray(gl, textureArrayId);
|
||||||
|
textureArrayId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bufferId != -1)
|
||||||
|
{
|
||||||
|
GLUtil.glDeleteBuffer(gl, bufferId);
|
||||||
|
bufferId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uvBufferId != -1)
|
||||||
|
{
|
||||||
|
GLUtil.glDeleteBuffer(gl, uvBufferId);
|
||||||
|
uvBufferId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uniformBufferId != -1)
|
||||||
|
{
|
||||||
|
GLUtil.glDeleteBuffer(gl, uniformBufferId);
|
||||||
|
uniformBufferId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
shutdownInterfaceTexture();
|
||||||
|
shutdownProgram();
|
||||||
|
shutdownVao();
|
||||||
|
|
||||||
|
if (!jawtWindow.getLock().isLocked())
|
||||||
|
{
|
||||||
|
jawtWindow.lockSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
glContext.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uvBufferId != -1)
|
if (jawtWindow != null)
|
||||||
{
|
{
|
||||||
GLUtil.glDeleteBuffer(gl, uvBufferId);
|
NewtFactoryAWT.destroyNativeWindow(jawtWindow);
|
||||||
uvBufferId = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uniformBufferId != -1)
|
|
||||||
{
|
|
||||||
GLUtil.glDeleteBuffer(gl, uniformBufferId);
|
|
||||||
uniformBufferId = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
shutdownInterfaceTexture();
|
|
||||||
shutdownProgram();
|
|
||||||
shutdownVao();
|
|
||||||
|
|
||||||
if (!jawtWindow.getLock().isLocked())
|
|
||||||
{
|
|
||||||
jawtWindow.lockSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
glContext.destroy();
|
|
||||||
NewtFactoryAWT.destroyNativeWindow(jawtWindow);
|
|
||||||
|
|
||||||
jawtWindow = null;
|
jawtWindow = null;
|
||||||
gl = null;
|
gl = null;
|
||||||
glDrawable = null;
|
glDrawable = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user