Free DisplayListData for Views with GONE parents
Bug: 22565656
Change-Id: I06060e6ae473482ec79feb891f9123c85706237f
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 351fbaa..df85cc6 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -79,6 +79,11 @@
mNeedsDisplayListSync = true;
delete mStagingDisplayList;
mStagingDisplayList = displayList;
+ // If mParentCount == 0 we are the sole reference to this RenderNode,
+ // so immediately free the old display list
+ if (!mParentCount && !mStagingDisplayList) {
+ deleteDisplayList();
+ }
}
/**