fix: More issues with OpenGL texture deallocation

This commit is contained in:
WerWolv 2025-02-26 18:35:36 +01:00
parent 5f61fe2c4f
commit 041f113402
1 changed files with 8 additions and 7 deletions

View File

@ -260,9 +260,6 @@ namespace ImGuiExt {
}
Texture::Texture(Texture&& other) noexcept {
if (m_textureId != 0)
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
m_textureId = other.m_textureId;
m_width = other.m_width;
m_height = other.m_height;
@ -271,8 +268,10 @@ namespace ImGuiExt {
}
Texture& Texture::operator=(Texture&& other) noexcept {
if (m_textureId != 0)
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
if (this == &other)
return *this;
this->reset();
m_textureId = other.m_textureId;
m_width = other.m_width;
@ -288,8 +287,10 @@ namespace ImGuiExt {
}
void Texture::reset() {
if (glDeleteTextures == nullptr)
return;
#if !defined(OS_WEB)
if (glDeleteTextures == nullptr)
return;
#endif
if (m_textureId != 0) {
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));