Fix apps collections segmentation fault
This CL has ShouldShowAppsCollection() verify that the client still exists before attempting to invoke IsNewUser from it. An AppListClient may be removed during shutdown before the AppsCollectionsController. Bug: 335362001 Change-Id: I5794ef4ba706fd8184cdb19806c9914e81f6c4d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5464379 Reviewed-by: Toni Barzic <tbarzic@chromium.org> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Commit-Queue: Ana Salazar <anasalazar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1290047}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
26f18f4d37
commit
79575e961b
ash/app_list
chrome/browser
@ -57,6 +57,7 @@ bool AppsCollectionsController::ShouldShowAppsCollection() {
|
||||
}
|
||||
|
||||
const auto* const session_controller = Shell::Get()->session_controller();
|
||||
|
||||
if (const auto user_type = session_controller->GetUserType();
|
||||
user_type != user_manager::UserType::kRegular) {
|
||||
return false;
|
||||
@ -76,6 +77,12 @@ bool AppsCollectionsController::ShouldShowAppsCollection() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the client was destroyed at this point, (i.e. in tests), return early to
|
||||
// avoid segmentation fault.
|
||||
if (!client_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::optional<bool>& is_new_user =
|
||||
client_->IsNewUser(session_controller->GetActiveAccountId());
|
||||
|
||||
|
@ -900,8 +900,7 @@ using AppListClientSearchResultsBrowserTest = extensions::ExtensionBrowserTest;
|
||||
|
||||
// Test showing search results, and uninstalling one of them while displayed.
|
||||
IN_PROC_BROWSER_TEST_F(AppListClientSearchResultsBrowserTest,
|
||||
// TODO(crbug.com/335362001): Re-enable this test
|
||||
DISABLED_UninstallSearchResult) {
|
||||
UninstallSearchResult) {
|
||||
base::FilePath test_extension_path;
|
||||
ASSERT_TRUE(
|
||||
base::PathService::Get(chrome::DIR_TEST_DATA, &test_extension_path));
|
||||
|
@ -193,8 +193,7 @@ IN_PROC_BROWSER_TEST_F(AppListSearchWithCustomizableShortcutsBrowserTest,
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(AppListSearchWithAppShortcutsBrowserTest,
|
||||
// TODO(crbug.com/335362001): Re-enable this test
|
||||
DISABLED_SearchWebAppShortcut) {
|
||||
SearchWebAppShortcut) {
|
||||
Profile* profile = ProfileManager::GetActiveUserProfile();
|
||||
ASSERT_TRUE(profile);
|
||||
// Associate `client` with the current profile.
|
||||
|
@ -58,8 +58,7 @@ class AppListWithRecentAppBrowserTest
|
||||
};
|
||||
|
||||
// TODO(crbug.com/335362001): Re-enable this test
|
||||
IN_PROC_BROWSER_TEST_F(AppListWithRecentAppBrowserTest,
|
||||
DISABLED_MouseClickAtRecentApp) {
|
||||
IN_PROC_BROWSER_TEST_F(AppListWithRecentAppBrowserTest, MouseClickAtRecentApp) {
|
||||
views::View* recent_app = app_list_test_api_.GetRecentAppAt(0);
|
||||
ASSERT_TRUE(recent_app);
|
||||
event_generator_->MoveMouseTo(recent_app->GetBoundsInScreen().CenterPoint());
|
||||
|
Reference in New Issue
Block a user