1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

LibGL: Check that texture name is allocated before marking it as free

glDeleteTextures previously did not check that the texture name was
allocated by glGenTextures before adding it to the free texture name
list.

This means that if you delete a texture twice in a row, the name will
appear twice in the free texture list, making glGenTextures return the
same texture name twice in a row.
This commit is contained in:
Luke Wilde 2022-06-01 14:38:58 +01:00 committed by Andreas Kling
parent a88e3bde18
commit bc5dd8dd0f
3 changed files with 46 additions and 2 deletions

View file

@ -107,11 +107,12 @@ void GLContext::gl_delete_textures(GLsizei n, GLuint const* textures)
if (name == 0)
continue;
m_name_allocator.free(name);
auto texture_object = m_allocated_textures.find(name);
if (texture_object == m_allocated_textures.end() || texture_object->value.is_null())
continue;
m_name_allocator.free(name);
auto texture = texture_object->value;
// Check all texture units