Mesa (master): st/egl: fix a crash in Android backend

Chia-I Wu olv at kemper.freedesktop.org
Fri Nov 25 03:19:14 UTC 2011


Module: Mesa
Branch: master
Commit: d3d3c12a95bddb7b624818af559ab6b18d890d2f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3d3c12a95bddb7b624818af559ab6b18d890d2f

Author: Chia-I Wu <olv at lunarg.com>
Date:   Thu Nov 24 17:13:15 2011 +0800

st/egl: fix a crash in Android backend

There is no buffer and android_surface_present should be a no-op when
eglSwapBuffers is called twice in a row.

---

 .../state_trackers/egl/android/native_android.cpp  |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp b/src/gallium/state_trackers/egl/android/native_android.cpp
index 5f4638a..490d6e8 100644
--- a/src/gallium/state_trackers/egl/android/native_android.cpp
+++ b/src/gallium/state_trackers/egl/android/native_android.cpp
@@ -355,9 +355,6 @@ android_surface_swap_buffers(struct native_surface *nsurf)
    struct android_surface *asurf = android_surface(nsurf);
    struct android_display *adpy = asurf->adpy;
 
-   if (!asurf->buf)
-      return TRUE;
-
    android_surface_enqueue_buffer(&asurf->base);
 
    asurf->stamp++;
@@ -395,6 +392,10 @@ android_surface_present(struct native_surface *nsurf,
    if (ctrl->swap_interval || ctrl->natt != NATIVE_ATTACHMENT_BACK_LEFT)
       return FALSE;
 
+   /* this happens when eglSwapBuffers is called more than once in a row */
+   if (!asurf->buf)
+      return TRUE;
+
    /* we always render to color_res first when it exists */
    if (asurf->color_res) {
       copy_resources(&adpy->base, asurf->color_res, asurf->buf_res);




More information about the mesa-commit mailing list