diff options
author | John Reck <jreck@google.com> | 2014-05-07 13:11:00 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2014-05-07 13:19:28 -0700 |
commit | 368cdd85268999997fb495cf90c4417221797de0 (patch) | |
tree | fd3194d75bfe69836ac286dd88cb7edde90fd140 | |
parent | ebb9e69513b690881a5bad7bf45c6f32e0fc7062 (diff) | |
download | frameworks_base-368cdd85268999997fb495cf90c4417221797de0.zip frameworks_base-368cdd85268999997fb495cf90c4417221797de0.tar.gz frameworks_base-368cdd85268999997fb495cf90c4417221797de0.tar.bz2 |
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
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index fc3548c..97baba8 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -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; |