diff options
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 0b6be19..43e653c 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -75,6 +75,9 @@ CREATE_BRIDGE1(destroyContext, CanvasContext* context) { void RenderProxy::destroyContext() { if (mContext) { + // Flush any pending changes to ensure all garbage is destroyed + mDrawFrameTask.flushStateChanges(&mRenderThread); + SETUP_TASK(destroyContext); args->context = mContext; mContext = 0; @@ -138,6 +141,10 @@ CREATE_BRIDGE1(destroyCanvas, CanvasContext* context) { } void RenderProxy::destroyCanvas() { + // If the canvas is being destroyed we won't be drawing again anytime soon + // So flush any pending state changes to allow for resource cleanup. + mDrawFrameTask.flushStateChanges(&mRenderThread); + SETUP_TASK(destroyCanvas); args->context = mContext; post(task); |