mirror of https://github.com/WerWolv/ImHex
fix: More issues with OpenGL texture deallocation
This commit is contained in:
parent
5f61fe2c4f
commit
041f113402
|
|
@ -260,9 +260,6 @@ namespace ImGuiExt {
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture::Texture(Texture&& other) noexcept {
|
Texture::Texture(Texture&& other) noexcept {
|
||||||
if (m_textureId != 0)
|
|
||||||
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
|
|
||||||
|
|
||||||
m_textureId = other.m_textureId;
|
m_textureId = other.m_textureId;
|
||||||
m_width = other.m_width;
|
m_width = other.m_width;
|
||||||
m_height = other.m_height;
|
m_height = other.m_height;
|
||||||
|
|
@ -271,8 +268,10 @@ namespace ImGuiExt {
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture& Texture::operator=(Texture&& other) noexcept {
|
Texture& Texture::operator=(Texture&& other) noexcept {
|
||||||
if (m_textureId != 0)
|
if (this == &other)
|
||||||
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
|
return *this;
|
||||||
|
|
||||||
|
this->reset();
|
||||||
|
|
||||||
m_textureId = other.m_textureId;
|
m_textureId = other.m_textureId;
|
||||||
m_width = other.m_width;
|
m_width = other.m_width;
|
||||||
|
|
@ -288,8 +287,10 @@ namespace ImGuiExt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::reset() {
|
void Texture::reset() {
|
||||||
if (glDeleteTextures == nullptr)
|
#if !defined(OS_WEB)
|
||||||
return;
|
if (glDeleteTextures == nullptr)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_textureId != 0) {
|
if (m_textureId != 0) {
|
||||||
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
|
glDeleteTextures(1, reinterpret_cast<GLuint*>(&m_textureId));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue