From ec0c92548071801c81e02ca72b9864739e1c080c Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 7 Jul 2014 16:30:41 -0700 Subject: Fix destroyHardwareResources The UI thread needs to know whether or not the display list is valid, so bring back View.destroyHardwareResources and instead have the native side assert that View did the right thing Change-Id: I4f8dee6e9c13ec7ab520becdc5cfe20e92a76f8f --- libs/hwui/RenderNode.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libs/hwui/RenderNode.cpp') diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 89105ea19fbd..3cf625fc08eb 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -211,7 +211,8 @@ void RenderNode::prepareTreeImpl(TreeInfo& info) { // This will also release the hardware layer if we have one as // isRenderable() will return false, thus causing pushLayerUpdate // to recycle the hardware layer - setStagingDisplayList(NULL); + LOG_ALWAYS_FATAL_IF(mStagingDisplayListData || (mDisplayListData && !mNeedsDisplayListDataSync), + "View.destroyHardwareResources wasn't called!"); break; } @@ -260,7 +261,11 @@ void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) { mNeedsDisplayListDataSync = false; // Do a push pass on the old tree to handle freeing DisplayListData // that are no longer used - TreeInfo oldTreeInfo(TreeInfo::MODE_MAYBE_DETACHING, info); + TreeInfo::TraversalMode mode = TreeInfo::MODE_MAYBE_DETACHING; + if (CC_UNLIKELY(info.mode == TreeInfo::MODE_DESTROY_RESOURCES)) { + mode = TreeInfo::MODE_DESTROY_RESOURCES; + } + TreeInfo oldTreeInfo(mode, info); prepareSubTree(oldTreeInfo, mDisplayListData); delete mDisplayListData; mDisplayListData = mStagingDisplayListData; -- cgit v1.2.3-59-g8ed1b