ecore_drm2: Clear next fb if we use it
authorDerek Foreman <derekf@osg.samsung.com>
Mon, 15 May 2017 19:29:55 +0000 (14:29 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Mon, 15 May 2017 21:22:12 +0000 (16:22 -0500)
Fixes a race that's either really hard to hit if you're a developer
or really easy to hit if you're a user.

Thanks to ApB for the debug assistance.

Fix T5484

src/lib/ecore_drm2/ecore_drm2_fb.c

index 114280b..71ea60d 100644 (file)
@@ -548,12 +548,16 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
         output->next.fb = fb;
         return 0;
      }
-   if (!fb) fb = output->next.fb;
+   if (!fb)
+     {
+        fb = output->next.fb;
+        output->next.fb = NULL;
+     }
 
    /* So we can generate a tick by flipping to the current fb */
    if (!fb) fb = output->current.fb;
 
-   if (output->next.fb && fb != output->next.fb)
+   if (output->next.fb)
      _release_buffer(output, &output->next);
 
    /* If we don't have an fb to set by now, BAIL! */