diff options
author | Mathias Agopian <mathias@google.com> | 2010-08-18 16:34:40 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-18 16:34:40 -0700 |
commit | 43647129d676e8c802850ca493f2ebc6064a4a1a (patch) | |
tree | a00c08ffbfe4c4e40f08b1c24884f4c1b423fa72 /opengl | |
parent | 4600139173c80db4ebfb70e2417231e9678d37f9 (diff) | |
parent | 17da06631041f9f2237738fb673a74a85b1d9cf4 (diff) | |
download | frameworks_base-43647129d676e8c802850ca493f2ebc6064a4a1a.zip frameworks_base-43647129d676e8c802850ca493f2ebc6064a4a1a.tar.gz frameworks_base-43647129d676e8c802850ca493f2ebc6064a4a1a.tar.bz2 |
am 17da0663: Merge "fix [2931161] crash in labyritnth when completing a level" into gingerbread
Merge commit '17da06631041f9f2237738fb673a74a85b1d9cf4' into gingerbread-plus-aosp
* commit '17da06631041f9f2237738fb673a74a85b1d9cf4':
fix [2931161] crash in labyritnth when completing a level
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libagl/egl.cpp | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 8b476c0..53cc398 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -576,41 +576,44 @@ EGLBoolean egl_window_surface_v2_t::swapBuffers() buffer = 0; // dequeue a new buffer - nativeWindow->dequeueBuffer(nativeWindow, &buffer); - - // TODO: lockBuffer should rather be executed when the very first - // direct rendering occurs. - nativeWindow->lockBuffer(nativeWindow, buffer); - - // reallocate the depth-buffer if needed - if ((width != buffer->width) || (height != buffer->height)) { - // TODO: we probably should reset the swap rect here - // if the window size has changed - width = buffer->width; - height = buffer->height; - if (depth.data) { - free(depth.data); - depth.width = width; - depth.height = height; - depth.stride = buffer->stride; - depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2); - if (depth.data == 0) { - setError(EGL_BAD_ALLOC, EGL_FALSE); - return EGL_FALSE; + if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) == NO_ERROR) { + + // TODO: lockBuffer should rather be executed when the very first + // direct rendering occurs. + nativeWindow->lockBuffer(nativeWindow, buffer); + + // reallocate the depth-buffer if needed + if ((width != buffer->width) || (height != buffer->height)) { + // TODO: we probably should reset the swap rect here + // if the window size has changed + width = buffer->width; + height = buffer->height; + if (depth.data) { + free(depth.data); + depth.width = width; + depth.height = height; + depth.stride = buffer->stride; + depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2); + if (depth.data == 0) { + setError(EGL_BAD_ALLOC, EGL_FALSE); + return EGL_FALSE; + } } } - } - - // keep a reference on the buffer - buffer->common.incRef(&buffer->common); - // finally pin the buffer down - if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN | - GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) { - LOGE("eglSwapBuffers() failed to lock buffer %p (%ux%u)", - buffer, buffer->width, buffer->height); - return setError(EGL_BAD_ACCESS, EGL_FALSE); - // FIXME: we should make sure we're not accessing the buffer anymore + // keep a reference on the buffer + buffer->common.incRef(&buffer->common); + + // finally pin the buffer down + if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN | + GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) { + LOGE("eglSwapBuffers() failed to lock buffer %p (%ux%u)", + buffer, buffer->width, buffer->height); + return setError(EGL_BAD_ACCESS, EGL_FALSE); + // FIXME: we should make sure we're not accessing the buffer anymore + } + } else { + return setError(EGL_BAD_CURRENT_SURFACE, EGL_FALSE); } return EGL_TRUE; |