Merge "SurfaceControl: Close CloseGuard when destroying surface in transaction." into pi-dev

am: 625de7758b

Change-Id: I254ad6e09b1e5a0677d4dfc52a6abe875c89e79d
This commit is contained in:
Rob Carr
2018-05-03 16:06:16 -07:00
committed by android-build-merger

View File

@@ -1580,6 +1580,20 @@ public class SurfaceControl implements Parcelable {
*/
public Transaction destroy(SurfaceControl sc) {
sc.checkNotReleased();
/**
* Perhaps it's safer to transfer the close guard to the Transaction
* but then we have a whole wonky scenario regarding merging, multiple
* close-guards per transaction etc...the whole scenario is kind of wonky
* and it seems really we'd like to just be able to call release here
* but the WindowManager has some code that looks like
* --- destroyInTransaction(a)
* --- reparentChildrenInTransaction(a)
* so we need to ensure the SC remains valid until the transaction
* is applied.
*/
sc.mCloseGuard.close();
nativeDestroy(mNativeObject, sc.mNativeObject);
return this;
}