[cogl/fosdem-2012: 6/20] texture-2d/wayland: destroy transient EGLImages
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/fosdem-2012: 6/20] texture-2d/wayland: destroy transient EGLImages
- Date: Mon, 16 Jan 2012 13:11:24 +0000 (UTC)
commit 8d14e7eedbd7af593e60637f462ee327f16f2a86
Author: Robert Bragg <robert linux intel com>
Date: Wed Jan 11 16:05:53 2012 +0000
texture-2d/wayland: destroy transient EGLImages
When creating a texture from a wayland buffer we create an intermediate
EGLImage that we then create a GL texture from, but we were never
destroying that EGLImage. This patch ensures we destroy the image right
after we've created the texture so we don't leak a reference to the
underlying buffer.
cogl/cogl-texture-2d.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c
index afa5cb9..3af0914 100644
--- a/cogl/cogl-texture-2d.c
+++ b/cogl/cogl-texture-2d.c
@@ -546,6 +546,7 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
else
{
EGLImageKHR image;
+ CoglTexture2D *tex;
_COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->criteria &
COGL_WINSYS_CRITERIA_USES_EGL,
@@ -555,12 +556,14 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
buffer,
NULL);
#warning "XXX: without a way to query the format of a wayland buffer we have to guess!"
- return _cogl_egl_texture_2d_new_from_image (ctx,
- buffer->width,
- buffer->height,
- COGL_PIXEL_FORMAT_RGB_888,
- image,
- error);
+ tex = _cogl_egl_texture_2d_new_from_image (ctx,
+ buffer->width,
+ buffer->height,
+ COGL_PIXEL_FORMAT_RGB_888,
+ image,
+ error);
+ _cogl_egl_destroy_image (ctx, image);
+ return tex;
}
}
#endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]