Browse Source

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

PSp..om 13 years ago
parent
commit
9ecaf0b96e
1 changed files with 5 additions and 1 deletions
  1. 5 1
      engine/src/core/com/jme3/util/BufferUtils.java

+ 5 - 1
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);