Skip to content

Commit

Permalink
we cannot use fallback because JAVA 8 :/
Browse files Browse the repository at this point in the history
  • Loading branch information
SrRapero720 committed Apr 27, 2024
1 parent cad7296 commit ce48153
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.srrapero720.watermedia.api.rendering;

import jdk.internal.ref.Cleaner;
import me.srrapero720.watermedia.api.WaterMediaAPI;
import me.srrapero720.watermedia.api.image.ImageRenderer;
import me.srrapero720.watermedia.api.rendering.memory.MemoryAlloc;
Expand All @@ -11,7 +10,6 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import sun.nio.ch.DirectBuffer;

import java.awt.*;
import java.awt.image.BufferedImage;
Expand Down Expand Up @@ -72,14 +70,14 @@ public static void freeByteBuffer(ByteBuffer buffer) {
} catch (Throwable t) {
if(!buffer.isDirect()) return;
try {
DirectBuffer db = (DirectBuffer) buffer;
if (db.attachment() != null)
throw new IllegalArgumentException("duplicate or slice");

Cleaner cleaner = db.cleaner();
if (cleaner != null) {
cleaner.clean();
}
// DirectBuffer db = (DirectBuffer) buffer;
// if (db.attachment() != null)
// throw new IllegalArgumentException("duplicate or slice");
//
// Cleaner cleaner = db.cleaner();
// if (cleaner != null) {
// cleaner.clean();
// }
} catch(Throwable ex) {
LOGGER.error(IT, "Failed to delete DirectByteBuffer");
}
Expand Down

0 comments on commit ce48153

Please sign in to comment.