aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-12 08:22:04 -0400
committerGitHub <noreply@github.com>2017-08-12 08:22:04 -0400
commit2d6d2bcef9ed8883bae25b0559d7703728f4a901 (patch)
treefa879db2667b8c05e8a4e55c3f0498bc7d763e52 /render
parent53a53f55b4f2212fbe81e77beca85f45400e12de (diff)
parent862bc9783fec224c2fc855169f5d615523702d6a (diff)
Merge pull request #75 from nyorain/egl_image_leak
Fix egl image leak in gles renderer
Diffstat (limited to 'render')
-rw-r--r--render/gles2/texture.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 5a28edbd..76d02419 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -179,6 +179,11 @@ static bool gles2_texture_upload_drm(struct wlr_texture_state *tex,
GL_CALL(glBindTexture(GL_TEXTURE_2D, tex->tex_id));
EGLint attribs[] = { EGL_WAYLAND_PLANE_WL, 0, EGL_NONE };
+
+ if (tex->image) {
+ wlr_egl_destroy_image(tex->egl, tex->image);
+ }
+
tex->image = wlr_egl_create_image(tex->egl, EGL_WAYLAND_BUFFER_WL,
(EGLClientBuffer*) buf, attribs);
if (!tex->image) {
@@ -216,7 +221,14 @@ static void gles2_texture_bind(struct wlr_texture_state *texture) {
static void gles2_texture_destroy(struct wlr_texture_state *texture) {
wl_signal_emit(&texture->wlr_texture->destroy_signal, texture->wlr_texture);
- GL_CALL(glDeleteTextures(1, &texture->tex_id));
+ if (texture->tex_id) {
+ GL_CALL(glDeleteTextures(1, &texture->tex_id));
+ }
+
+ if (texture->image) {
+ wlr_egl_destroy_image(texture->egl, texture->image);
+ }
+
free(texture);
}