From 8b5f4cba3632c1a05e8a3fdec9e8320a3cbb370c Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sun, 20 May 2012 19:54:58 +0000 Subject: [PATCH] * BufferUtils.destroyDirectBuffer() now works on Android git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9408 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/util/BufferUtils.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engine/src/core/com/jme3/util/BufferUtils.java b/engine/src/core/com/jme3/util/BufferUtils.java index 46837e5f9..c96ee47f2 100644 --- a/engine/src/core/com/jme3/util/BufferUtils.java +++ b/engine/src/core/com/jme3/util/BufferUtils.java @@ -1183,10 +1183,13 @@ public final class BufferUtils { } // Apache Harmony - freeMethod = loadMethod("org.apache.harmony.nio.internal.DirectBuffer", "free"); - - // GUN Classpath (not likely) - //finalizeMethod = loadMethod("java.nio.DirectByteBufferImpl", "finalize"); + ByteBuffer bb = BufferUtils.createByteBuffer(1); + Class clazz = bb.getClass(); + try { + freeMethod = clazz.getMethod("free"); + } catch (NoSuchMethodException ex) { + } catch (SecurityException ex) { + } } }