diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 38687e04c2..3d65bb8088 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -673,10 +673,12 @@ void SoftwareGLContext::gl_delete_textures(GLsizei n, const GLuint* textures) RETURN_WITH_ERROR_IF(n < 0, GL_INVALID_VALUE); RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); - m_name_allocator.free(n, textures); - for (auto i = 0; i < n; i++) { GLuint name = textures[i]; + 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()) diff --git a/Userland/Libraries/LibGL/Tex/NameAllocator.cpp b/Userland/Libraries/LibGL/Tex/NameAllocator.cpp index cd1baea73b..f1cd1be758 100644 --- a/Userland/Libraries/LibGL/Tex/NameAllocator.cpp +++ b/Userland/Libraries/LibGL/Tex/NameAllocator.cpp @@ -22,12 +22,9 @@ void TextureNameAllocator::allocate(GLsizei count, GLuint* textures) } } -void TextureNameAllocator::free(GLsizei count, const GLuint* textures) +void TextureNameAllocator::free(GLuint texture) { - size_t tex_array_index = 0; - - while (count-- > 0) - m_free_texture_names.push(textures[tex_array_index++]); + m_free_texture_names.push(texture); } } diff --git a/Userland/Libraries/LibGL/Tex/NameAllocator.h b/Userland/Libraries/LibGL/Tex/NameAllocator.h index 6f596474f0..c40a88476b 100644 --- a/Userland/Libraries/LibGL/Tex/NameAllocator.h +++ b/Userland/Libraries/LibGL/Tex/NameAllocator.h @@ -16,7 +16,7 @@ public: TextureNameAllocator() = default; void allocate(GLsizei count, GLuint* textures); - void free(GLsizei count, const GLuint* textures); + void free(GLuint texture); private: Stack m_free_texture_names;