Finish all GL commands on Mac after buffer deletion

Hopefully this will fix GL buffer SIGSEV and/or memory corruption.
This commit is contained in:
James Seibel
2026-02-13 07:39:59 -06:00
parent 42d2cc6915
commit 7963303a48
@@ -25,6 +25,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.opengl.GlStateManager;
#endif
import com.seibel.distanthorizons.core.jar.EPlatform;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftGLWrapper;
@@ -190,6 +191,16 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
{
GL32.glDeleteBuffers(buffer);
// attempt to fix a bug with Mac where de-allocated buffers
// are still being used, causing a SIGSEGV native crash
// and/or corrupting native memory
if (EPlatform.get() == EPlatform.MACOS)
{
// force the delete buffer (and any other in-flight) GL
// commands to finish before continuing
GL32.glFinish();
}
// MC's implementation has a bug where it will throw:
// GL_INVALID_OPERATION in glBufferData(immutable)
// when attempting to delete Storage Buffers