Fix bug removing all windows that belong to a display.

Removing one window causes its subwindows to also be removed.
We have to be careful when traversing the window list
because multiple windows may be removed at a time so we
don't get IndexOutOfBoundsException due to the window
list changing in unexpected ways.

Bug: 7273702
Change-Id: I0ed9ba00c325ad178ab28919ce2e763cb6fd38ba
This commit is contained in:
Jeff Brown
2012-10-02 16:35:35 -07:00
parent c2726643e7
commit cb882f90e4

View File

@ -10870,8 +10870,8 @@ public class WindowManagerService extends IWindowManager.Stub
final DisplayContent displayContent = getDisplayContentLocked(displayId);
mDisplayContents.delete(displayId);
WindowList windows = displayContent.getWindowList();
for (int i = windows.size() - 1; i >= 0; --i) {
final WindowState win = windows.get(i);
while (!windows.isEmpty()) {
final WindowState win = windows.get(windows.size() - 1);
removeWindowLocked(win.mSession, win);
}
mAnimator.removeDisplayLocked(displayId);