Merge "Provide synchronization to setview to avoid NPE"

This commit is contained in:
Treehugger Robot
2016-09-23 12:57:57 +00:00
committed by Gerrit Code Review

View File

@@ -335,20 +335,17 @@ public final class WindowManagerGlobal {
mViews.add(view); mViews.add(view);
mRoots.add(root); mRoots.add(root);
mParams.add(wparams); mParams.add(wparams);
}
// do this last because it fires off messages to start doing things // do this last because it fires off messages to start doing things
try { try {
root.setView(view, wparams, panelParentView); root.setView(view, wparams, panelParentView);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// BadTokenException or InvalidDisplayException, clean up. // BadTokenException or InvalidDisplayException, clean up.
synchronized (mLock) {
final int index = findViewLocked(view, false);
if (index >= 0) { if (index >= 0) {
removeViewLocked(index, true); removeViewLocked(index, true);
} }
throw e;
} }
throw e;
} }
} }