Skip to content

Commit 1f59e5c

Browse files
author
Romain Guy
committed
Attempt to recover from apps destroying their window at draw time
Bug #6436642 Change-Id: I906b9c68225683f97b9c97c153a1132cf9ac6509
1 parent ab4c4f4 commit 1f59e5c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/java/android/view/ViewRootImpl.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ public final class ViewRootImpl implements ViewParent,
230230
boolean mHasHadWindowFocus;
231231
boolean mLastWasImTarget;
232232
boolean mWindowsAnimating;
233+
boolean mIsDrawing;
233234
int mLastSystemUiVisibility;
234235

235236
// Pool of queued input events.
@@ -2037,10 +2038,12 @@ private void performDraw() {
20372038
final boolean fullRedrawNeeded = mFullRedrawNeeded;
20382039
mFullRedrawNeeded = false;
20392040

2041+
mIsDrawing = true;
20402042
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "draw");
20412043
try {
20422044
draw(fullRedrawNeeded);
20432045
} finally {
2046+
mIsDrawing = false;
20442047
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
20452048
}
20462049

@@ -3962,7 +3965,12 @@ public void die(boolean immediate) {
39623965
if (immediate) {
39633966
doDie();
39643967
} else {
3965-
destroyHardwareRenderer();
3968+
if (!mIsDrawing) {
3969+
destroyHardwareRenderer();
3970+
} else {
3971+
Log.e(TAG, "Attempting to destroy the window while drawing!\n" +
3972+
" window=" + this + ", title=" + mWindowAttributes.getTitle());
3973+
}
39663974
mHandler.sendEmptyMessage(MSG_DIE);
39673975
}
39683976
}

0 commit comments

Comments
 (0)