<div dir="ltr">May I suggest <a href="https://github.com/Zoxc/weston/commit/062f5ca5dc5809c027f693f2d642bc24f568e348">https://github.com/Zoxc/weston/commit/062f5ca5dc5809c027f693f2d642bc24f568e348</a> instead?<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Jun 5, 2013 at 11:21 AM, Ander Conselvan de Oliveira <span dir="ltr"><<a href="mailto:conselvan2@gmail.com" target="_blank">conselvan2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Ander Conselvan de Oliveira <<a href="mailto:ander.conselvan.de.oliveira@intel.com">ander.conselvan.de.oliveira@intel.com</a>><br>
<br>
When attaching a new buffer, the EGL images created for the previous one<br>
would be released if this new buffer was an EGL or NULL buffer, but not<br>
if is was an SHM buffer. This wouldn't cause the resources to be leaked<br>
becaused they are free()'d when the surface is destroyed, but they<br>
would linger around for longer than necessary.<br>
<br>
Note that this change the behaviour when attaching an unknow buffer<br>
type. Before the EGL images would still be around, but now that would<br>
cause them to be destroyed.<br>
---<br>
src/gl-renderer.c | 14 ++++++--------<br>
1 file changed, 6 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/gl-renderer.c b/src/gl-renderer.c<br>
index d783a0b..13c0fa9 100644<br>
--- a/src/gl-renderer.c<br>
+++ b/src/gl-renderer.c<br>
@@ -1192,12 +1192,13 @@ gl_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)<br>
<br>
weston_buffer_reference(&gs->buffer_ref, buffer);<br>
<br>
+ for (i = 0; i < gs->num_images; i++) {<br>
+ gr->destroy_image(gr->egl_display, gs->images[i]);<br>
+ gs->images[i] = NULL;<br>
+ }<br>
+ gs->num_images = 0;<br>
+<br>
if (!buffer) {<br>
- for (i = 0; i < gs->num_images; i++) {<br>
- gr->destroy_image(gr->egl_display, gs->images[i]);<br>
- gs->images[i] = NULL;<br>
- }<br>
- gs->num_images = 0;<br>
glDeleteTextures(gs->num_textures, gs->textures);<br>
gs->num_textures = 0;<br>
return;<br>
@@ -1219,9 +1220,6 @@ gl_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)<br>
gs->shader = &gr->texture_shader_rgba;<br>
} else if (gr->query_buffer(gr->egl_display, buffer,<br>
EGL_TEXTURE_FORMAT, &format)) {<br>
- for (i = 0; i < gs->num_images; i++)<br>
- gr->destroy_image(gr->egl_display, gs->images[i]);<br>
- gs->num_images = 0;<br>
gs->target = GL_TEXTURE_2D;<br>
switch (format) {<br>
case EGL_TEXTURE_RGB:<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.9.5<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>