From 9ecaf0b96e0f7f8e200e5749d86520789bc9f7ff Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Mon, 30 Jan 2012 10:37:30 +0000 Subject: [PATCH] Expand the destroyByteBuffer() call to take any Buffer and do a safety check for isDirect(). This should let it free FloatBuffers, etc. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9120 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/util/BufferUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/src/core/com/jme3/util/BufferUtils.java b/engine/src/core/com/jme3/util/BufferUtils.java index a927124ec..719d4832a 100644 --- a/engine/src/core/com/jme3/util/BufferUtils.java +++ b/engine/src/core/com/jme3/util/BufferUtils.java @@ -1156,7 +1156,11 @@ public final class BufferUtils { * The DirectByteBuffer that will be "cleaned". Utilizes reflection. * */ - public static void destroyByteBuffer(ByteBuffer toBeDestroyed) { + public static void destroyByteBuffer(Buffer toBeDestroyed) { + + if (!toBeDestroyed.isDirect()) { + return; + } try { Method cleanerMethod = toBeDestroyed.getClass().getMethod("cleaner"); cleanerMethod.setAccessible(true);