From c0a57a62e8f6939f3fbdb50b312626eaabb9b87d Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 5 Oct 2020 18:26:24 -0400 Subject: [PATCH] gpu: dispose of graphics objects --- .../java/net/runelite/client/plugins/gpu/GpuPlugin.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 80fb90742f..18a2d5acd6 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 @@ -1305,9 +1305,11 @@ public class GpuPlugin extends Plugin implements DrawCallbacks if (OSType.getOSType() != OSType.MacOS) { - final AffineTransform t = ((Graphics2D) canvas.getGraphics()).getTransform(); + final Graphics2D graphics = (Graphics2D) canvas.getGraphics(); + final AffineTransform t = graphics.getTransform(); width = getScaledValue(t.getScaleX(), width); height = getScaledValue(t.getScaleY(), height); + graphics.dispose(); } ByteBuffer buffer = ByteBuffer.allocateDirect(width * height * 4) @@ -1595,12 +1597,14 @@ public class GpuPlugin extends Plugin implements DrawCallbacks } else { - final AffineTransform t = ((Graphics2D) canvas.getGraphics()).getTransform(); + final Graphics2D graphics = (Graphics2D) canvas.getGraphics(); + final AffineTransform t = graphics.getTransform(); gl.glViewport( getScaledValue(t.getScaleX(), x), getScaledValue(t.getScaleY(), y), getScaledValue(t.getScaleX(), width), getScaledValue(t.getScaleY(), height)); + graphics.dispose(); } }