ref: e96ee6ed897090223f897a344d090b3f172c4af6
parent: 9ea6caad72938bbe113376ec6a5c2202728da6d5
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Sep 14 19:43:18 EDT 2020
Don't leave dangling OpenGL texture IDs
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -675,9 +675,17 @@
return;
// Flush the vertex buffer if we're about to destroy its texture
- // TODO - This leaves `last_source_texture`/`last_destination_texture` dangling
- if (surface->texture_id == last_source_texture || surface->texture_id == last_destination_texture)
+ if (surface->texture_id == last_source_texture)
+ {
FlushVertexBuffer();
+ last_source_texture = 0;
+ }
+
+ if (surface->texture_id == last_destination_texture)
+ {
+ FlushVertexBuffer();
+ last_destination_texture = 0;
+ }
glDeleteTextures(1, &surface->texture_id);
free(surface);