diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-02-15 00:13:36 +0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2022-03-04 11:28:37 +0100 |
commit | 6cdcf8810744cbc67074468b7f3c2f50f8e3539c (patch) | |
tree | 80a17bbc67867add520e0bb624d9508c85ee57e6 | |
parent | a9fbce5e94d6b68ec8404f8a466fde873ba2bc73 (diff) | |
download | qemu-6cdcf8810744cbc67074468b7f3c2f50f8e3539c.zip qemu-6cdcf8810744cbc67074468b7f3c2f50f8e3539c.tar.gz qemu-6cdcf8810744cbc67074468b7f3c2f50f8e3539c.tar.bz2 |
ui/console: fix texture leak when calling surface_gl_create_texture()
Make surface_gl_create_texture() idempotent: if the surface is already
bound to a texture, do not create a new one.
This fixes texture leaks when there are multiple DBus listeners, for
example.
Reported-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220214201337.1814787-3-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | ui/console-gl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/console-gl.c b/ui/console-gl.c index 7c9894a..8e3c9a3 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -49,6 +49,10 @@ void surface_gl_create_texture(QemuGLShader *gls, assert(gls); assert(QEMU_IS_ALIGNED(surface_stride(surface), surface_bytes_per_pixel(surface))); + if (surface->texture) { + return; + } + switch (surface->format) { case PIXMAN_BE_b8g8r8x8: case PIXMAN_BE_b8g8r8a8: |