Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8ba0b46 authored by Romain Guy's avatar Romain Guy
Browse files

When destroying a surface, only unmake current if necessary

Bug #9404946

The Calendar app destroys one of its popup windows during a draw
traversal. Without this patch, we end up with no current context
nor surface after we're done gathering display lists. This means
that all of our EGL/GL calls will either fail or have undefined
behaviors. This could explain the PBO crash we are seeing with
the monkeys. Without a proper GL context, the driver returns NULL
when we map the PBO in CPU memory.

Change-Id: I210cf724be73da909a7621f807298a9f4a58e61d
parent 27e0bf62
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1301,7 +1301,10 @@ public abstract class HardwareRenderer {

        void destroySurface() {
            if (mEglSurface != null && mEglSurface != EGL_NO_SURFACE) {
                sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
                if (mEglSurface.equals(sEgl.eglGetCurrentSurface(EGL_DRAW))) {
                    sEgl.eglMakeCurrent(sEglDisplay,
                            EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
                }
                sEgl.eglDestroySurface(sEglDisplay, mEglSurface);
                mEglSurface = null;
            }