Fence on destruction
Bug: 14052927
destroyCanvasAndSurface() needs a fence as when it returns the
underlying BufferQueue is going to be released from under
the render thread.
Change-Id: I0147a1d5ec5adf0239c761ef22f65cd8c8a137df
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index b233ae9..ce490f1 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -140,15 +140,18 @@
mDrawFrameTask.drawFrame(&mRenderThread);
}
-CREATE_BRIDGE1(destroyCanvas, CanvasContext* context) {
- args->context->destroyCanvas();
+CREATE_BRIDGE1(destroyCanvasAndSurface, CanvasContext* context) {
+ args->context->destroyCanvasAndSurface();
return NULL;
}
-void RenderProxy::destroyCanvas() {
- SETUP_TASK(destroyCanvas);
+void RenderProxy::destroyCanvasAndSurface() {
+ SETUP_TASK(destroyCanvasAndSurface);
args->context = mContext;
- post(task);
+ // destroyCanvasAndSurface() needs a fence as when it returns the
+ // underlying BufferQueue is going to be released from under
+ // the render thread.
+ postAndWait(task);
}
CREATE_BRIDGE2(invokeFunctor, CanvasContext* context, Functor* functor) {