<div dir="ltr"><div>Hi,</div><div><br></div><div>ping for review :)<br></div><div><br><div class="gmail_quote"><div dir="ltr">Le lun. 29 oct. 2018 à 14:46, Alexandre Janniaux <<a href="mailto:alexandre.janniaux@gmail.com">alexandre.janniaux@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fix pictures being released twice when using<br>
VOUT_DISPLAY_RESET_PICTURES.<br>
---<br>
modules/video_output/wayland/shm.c | 18 ++++++++++++------<br>
1 file changed, 12 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c<br>
index 590cf78151..47f001420b 100644<br>
--- a/modules/video_output/wayland/shm.c<br>
+++ b/modules/video_output/wayland/shm.c<br>
@@ -72,12 +72,15 @@ static void buffer_release_cb(void *data, struct wl_buffer *buffer)<br>
{<br>
picture_t *pic = data;<br>
<br>
-#ifndef NDEBUG<br>
- assert(pic != NULL);<br>
+ /* Detach the picture from the buffer so we don't release it again when<br>
+ * reseting all the pictures */<br>
wl_buffer_set_user_data(buffer, NULL);<br>
-#else<br>
- (void) buffer;<br>
-#endif<br>
+<br>
+ /* We can't queue buffer without a corresponding picture */<br>
+ assert(pic);<br>
+<br>
+ /* The release event happens when the compositor replaced our buffer by a<br>
+ * new one, signaling it doesn't need it anymore */<br>
picture_Release(pic);<br>
}<br>
<br>
@@ -90,7 +93,8 @@ static void PictureDetach(void *data, picture_t *pic)<br>
{<br>
struct wl_buffer *buf = (struct wl_buffer *)pic->p_sys;<br>
<br>
- /* Detach the buffer if it is attached */<br>
+ /* Release the picture if it is still attached to the buffer, after calling<br>
+ * VOUT_DISPLAY_RESET_PICTURES while rendering frames */<br>
pic = wl_buffer_get_user_data(buf);<br>
if (pic != NULL)<br>
buffer_release_cb(pic, buf);<br>
@@ -189,6 +193,8 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)<br>
break;<br>
}<br>
<br>
+ /* We won't queue a buffer without associating a picture before so we<br>
+ * can set buffer userdata to NULL here */<br>
wl_buffer_add_listener(buf, &buffer_cbs, NULL);<br>
pics[count++] = pic;<br>
}<br>
-- <br>
2.19.1<br>
<br>
</blockquote></div></div></div>