Skip to content

Commit 5ab92c0

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Make sure we clean up after ourselves"
2 parents 837d321 + edbca12 commit 5ab92c0

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

core/java/android/view/ViewRootImpl.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,7 @@ private void draw(boolean fullRedrawNeeded) {
21302130
}
21312131

21322132
/**
2133-
* @return true if drawing was succesful, false if an error occured
2133+
* @return true if drawing was succesfull, false if an error occurred
21342134
*/
21352135
private boolean drawSoftware(Surface surface, AttachInfo attachInfo, int yoff,
21362136
boolean scalingRequired, Rect dirty) {
@@ -3843,30 +3843,33 @@ void doDie() {
38433843
if (LOCAL_LOGV) Log.v(TAG, "DIE in " + this + " of " + mSurface);
38443844
synchronized (this) {
38453845
if (mAdded) {
3846-
mAdded = false;
38473846
dispatchDetachedFromWindow();
38483847
}
38493848

38503849
if (mAdded && !mFirst) {
38513850
destroyHardwareRenderer();
38523851

3853-
int viewVisibility = mView.getVisibility();
3854-
boolean viewVisibilityChanged = mViewVisibility != viewVisibility;
3855-
if (mWindowAttributesChanged || viewVisibilityChanged) {
3856-
// If layout params have been changed, first give them
3857-
// to the window manager to make sure it has the correct
3858-
// animation info.
3859-
try {
3860-
if ((relayoutWindow(mWindowAttributes, viewVisibility, false)
3861-
& WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0) {
3862-
sWindowSession.finishDrawing(mWindow);
3852+
if (mView != null) {
3853+
int viewVisibility = mView.getVisibility();
3854+
boolean viewVisibilityChanged = mViewVisibility != viewVisibility;
3855+
if (mWindowAttributesChanged || viewVisibilityChanged) {
3856+
// If layout params have been changed, first give them
3857+
// to the window manager to make sure it has the correct
3858+
// animation info.
3859+
try {
3860+
if ((relayoutWindow(mWindowAttributes, viewVisibility, false)
3861+
& WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0) {
3862+
sWindowSession.finishDrawing(mWindow);
3863+
}
3864+
} catch (RemoteException e) {
38633865
}
3864-
} catch (RemoteException e) {
38653866
}
3867+
3868+
mSurface.release();
38663869
}
3867-
3868-
mSurface.release();
38693870
}
3871+
3872+
mAdded = false;
38703873
}
38713874
}
38723875

0 commit comments

Comments
 (0)