Fix Profile* lifetime issues in Chrome's AppListViewDelegate
Currently AppListViewDelegate can hold on to references to a destroyed Profile*. It's managed to escape crashing in most cases so far because the LocalState pref is updated for the next time the app launcher is shown. However, if the profile the app launcher is first created for is ever deleted in the same session, then a crash usually follows (but doesn't always create a crash dump, due to a corrupt stack). This decouples the Profile from the AppListViewDelegate constructor to make it clear the lifetimes are not in step. Then "SetProfile" correctly tears down any references to an old profile, before setting a new one. When the app list's active profile is deleted, the AppListViewDelegate is destroyed by forcibly closing/destroying the AppList's widget via a new method AppListServiceImpl::DestroyAppList(). BUG=392763, 403647, 373689, 405827 TEST=(windows) Show the app list, right-click an app and "uninstall". Leave the uninstall dialog open. Switch to a chrome://settings in a browser and delete the profile being shown in the app list. App list should close. Review URL: https://codereview.chromium.org/492163002 Cr-Commit-Position: refs/heads/master@{#291852}
Showing
Please register or sign in to comment