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
3.0
PSp..om 13 years ago
parent b1d4c36fd7
commit 9ecaf0b96e
  1. 6
      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);

Loading…
Cancel
Save