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

Commit 368cdd85 authored by John Reck's avatar John Reck
Browse files

Don't try to draw if there's no canvas or surface

 Bug: 14616376

 doFrame() can happen after the canvas or surface is destroyed,
 handle it gracefully

Change-Id: Ibbbbdbfa77fa2134bd2abc215ca1a0886d706969
parent ebb9e695
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -349,6 +349,8 @@ void CanvasContext::setSurface(EGLNativeWindowType window) {
        mDirtyRegionsEnabled = mGlobalContext->enableDirtyRegions(mEglSurface);
        mHaveNewSurface = true;
        makeCurrent();
    } else {
        mRenderThread.removeFrameCallback(this);
    }
}

@@ -468,6 +470,10 @@ void CanvasContext::draw(Rect* dirty) {

// Called by choreographer to do an RT-driven animation
void CanvasContext::doFrame() {
    if (CC_UNLIKELY(!mCanvas || mEglSurface == EGL_NO_SURFACE)) {
        return;
    }

    ATRACE_CALL();

    TreeInfo info;