From b100a9c16cf322f961fecce0d1d7a9f6e3c989b8 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 19 Nov 2018 12:54:19 +0100 Subject: [PATCH] Properly destroy JAWT window on plugin shutdown This is necessary in order to properly free all resources on e.g Linux (happens less often on Windows). Without NewtFactoryAWT.destroyNativeWindow, the JAWT window created display stays open after disabling the plugin and is freed only on application close. Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/gpu/GpuPlugin.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 83363750ea..ab5047066a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -26,7 +26,6 @@ package net.runelite.client.plugins.gpu; import com.google.common.eventbus.Subscribe; import com.google.inject.Provides; -import com.jogamp.nativewindow.NativeSurface; import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; import com.jogamp.nativewindow.awt.JAWTWindow; import com.jogamp.opengl.GL; @@ -328,11 +327,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks client.setGpu(false); client.setDrawCallbacks(null); - if (jawtWindow.getLock().getHoldCount() != NativeSurface.LOCK_SURFACE_NOT_READY) - { - jawtWindow.lockSurface(); - } - if (bufferId != -1) { GLUtil.glDeleteBuffer(gl, bufferId); @@ -355,7 +349,13 @@ public class GpuPlugin extends Plugin implements DrawCallbacks shutdownProgram(); shutdownVao(); + if (!jawtWindow.getLock().isLocked()) + { + jawtWindow.lockSurface(); + } + glContext.destroy(); + NewtFactoryAWT.destroyNativeWindow(jawtWindow); jawtWindow = null; gl = null;