diff options
author | Robert Bragg <robert@linux.intel.com> | 2012-01-11 16:05:53 +0000 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-02-08 17:00:25 +0000 |
commit | 161fad2860700e2b6e9a790498eef23d3af4ee86 (patch) | |
tree | c589807aff417413ec880f57a1c956046d4de427 /cogl/cogl-texture-2d.c | |
parent | 99c651d2b4c5e713bcae260b850f1183e935e95c (diff) | |
download | cogl-161fad2860700e2b6e9a790498eef23d3af4ee86.tar.gz |
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.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/cogl-texture-2d.c')
-rw-r--r-- | cogl/cogl-texture-2d.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c index 97e449c4..794f1864 100644 --- a/cogl/cogl-texture-2d.c +++ b/cogl/cogl-texture-2d.c @@ -540,6 +540,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)->constraints & COGL_RENDERER_CONSTRAINT_USES_EGL, @@ -548,13 +549,14 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx, EGL_WAYLAND_BUFFER_WL, 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_ARGB_8888_PRE, - image, - error); + tex = _cogl_egl_texture_2d_new_from_image (ctx, + buffer->width, + buffer->height, + COGL_PIXEL_FORMAT_ARGB_8888_PRE, + image, + error); + _cogl_egl_destroy_image (ctx, image); + return tex; } } #endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */ |