]> git.sesse.net Git - vlc/commitdiff
Mimic X11 plugin picture allocation
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 16 Apr 2009 18:00:22 +0000 (21:00 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 16 Apr 2009 18:00:22 +0000 (21:00 +0300)
(It still crashes on resize nevertheless)

modules/video_output/xcb/xcb.c

index 99520d99b531e7abf5f92fdbbb8555ae196e95d5..b4d9a0faf76706edf140577154a407bbd284f0f6 100644 (file)
@@ -484,15 +484,19 @@ static int Init (vout_thread_t *vout)
     xcb_flush (p_sys->conn);
 
     /* Allocate picture buffers */
-    do
+    I_OUTPUTPICTURES = 0;
+    for (size_t index = 0; I_OUTPUTPICTURES < 2; index++)
     {
-        picture_t *pic = vout->p_picture + I_OUTPUTPICTURES;
+        picture_t *pic = vout->p_picture + index;
 
+        if (index > sizeof (vout->p_picture) / sizeof (pic))
+            break;
+        if (pic->i_status != FREE_PICTURE)
+            continue;
         if (PictureInit (vout, pic))
             break;
         PP_OUTPUTPICTURE[I_OUTPUTPICTURES++] = pic;
     }
-    while (I_OUTPUTPICTURES < 2);
 
     return VLC_SUCCESS;