From e730a250b78734b75fffb9870f7456cda443f09c Mon Sep 17 00:00:00 2001 From: Atdunbg Date: Fri, 5 Dec 2025 02:08:27 +0800 Subject: [PATCH] =?UTF-8?q?Fixed=20the=20issue=20where=20the=20program=20w?= =?UTF-8?q?ouldn=E2=80=99t=20close=20properly=20in=20binaries=20built=20wi?= =?UTF-8?q?th=20MinGW?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Prism/src/Prism/Platform/OpenGL/OpenGLBuffer.cpp | 8 ++++++++ Prism/src/Prism/Platform/OpenGL/OpenGLFrameBuffer.cpp | 4 ++++ Prism/src/Prism/Platform/OpenGL/OpenGLTexture.cpp | 8 ++++++++ Prism/src/Prism/Platform/OpenGL/OpenGLVertexArray.cpp | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/Prism/src/Prism/Platform/OpenGL/OpenGLBuffer.cpp b/Prism/src/Prism/Platform/OpenGL/OpenGLBuffer.cpp index 7c237fd..62a0965 100644 --- a/Prism/src/Prism/Platform/OpenGL/OpenGLBuffer.cpp +++ b/Prism/src/Prism/Platform/OpenGL/OpenGLBuffer.cpp @@ -46,9 +46,13 @@ namespace Prism OpenGLVertexBuffer::~OpenGLVertexBuffer() { +#ifdef __MINGW32__ + glDeleteBuffers(1, &m_RendererID); +#else Renderer::Submit([this](){ glDeleteBuffers(1, &m_RendererID); }); +#endif } void OpenGLVertexBuffer::SetData(void* buffer, uint32_t size, uint32_t offset) @@ -89,9 +93,13 @@ namespace Prism OpenGLIndexBuffer::~OpenGLIndexBuffer() { +#ifdef __MINGW32__ + glDeleteBuffers(1, &m_RendererID); +#else Renderer::Submit([this](){ glDeleteBuffers(1, &m_RendererID); }); +#endif } void OpenGLIndexBuffer::SetData(void* data, uint32_t size, uint32_t offset) diff --git a/Prism/src/Prism/Platform/OpenGL/OpenGLFrameBuffer.cpp b/Prism/src/Prism/Platform/OpenGL/OpenGLFrameBuffer.cpp index 6ed574c..b150938 100644 --- a/Prism/src/Prism/Platform/OpenGL/OpenGLFrameBuffer.cpp +++ b/Prism/src/Prism/Platform/OpenGL/OpenGLFrameBuffer.cpp @@ -19,9 +19,13 @@ namespace Prism OpenGLFrameBuffer::~OpenGLFrameBuffer() { +#ifdef __MINGW32__ + glDeleteFramebuffers(1, &m_RendererID); +#else Renderer::Submit([=](){ glDeleteFramebuffers(1, &m_RendererID); }); +#endif } void OpenGLFrameBuffer::Bind() const diff --git a/Prism/src/Prism/Platform/OpenGL/OpenGLTexture.cpp b/Prism/src/Prism/Platform/OpenGL/OpenGLTexture.cpp index 8c058bd..927a525 100644 --- a/Prism/src/Prism/Platform/OpenGL/OpenGLTexture.cpp +++ b/Prism/src/Prism/Platform/OpenGL/OpenGLTexture.cpp @@ -116,9 +116,13 @@ namespace Prism OpenGLTexture2D::~OpenGLTexture2D() { +#ifdef __MINGW32__ + glDeleteTextures(1, &m_RendererID); +#else Renderer::Submit([this](){ glDeleteTextures(1, &m_RendererID); }); +#endif } void OpenGLTexture2D::Bind(uint32_t slot) const @@ -275,9 +279,13 @@ namespace Prism OpenGLTextureCube::~OpenGLTextureCube() { +#ifdef __MINGW32__ + glDeleteTextures(1, &m_RendererID); +#else Renderer::Submit([this]() { glDeleteTextures(1, &m_RendererID); }); +#endif } void OpenGLTextureCube::Bind(uint32_t slot) const diff --git a/Prism/src/Prism/Platform/OpenGL/OpenGLVertexArray.cpp b/Prism/src/Prism/Platform/OpenGL/OpenGLVertexArray.cpp index 51c5386..7632c39 100644 --- a/Prism/src/Prism/Platform/OpenGL/OpenGLVertexArray.cpp +++ b/Prism/src/Prism/Platform/OpenGL/OpenGLVertexArray.cpp @@ -38,9 +38,13 @@ namespace Prism OpenGLVertexArray::~OpenGLVertexArray() { +#ifdef __MINGW32__ + glDeleteVertexArrays(1, &m_RendererID); +#else Renderer::Submit([this](){ glDeleteVertexArrays(1, &m_RendererID); }); +#endif } void OpenGLVertexArray::Bind() const