Commit 4e7e13e1 authored by khmel@google.com's avatar khmel@google.com Committed by Commit Bot

Fix crash on activating Crostini terminal app.

This is update for reland crrev.com/c/1145563

TBR=xiyuan@chromium.org

Bug: 822488
Test: Manually
Change-Id: If3a0ab1ff717b04a3f9c9995c0522c43fc0aba4b
Reviewed-on: https://chromium-review.googlesource.com/1145787
Commit-Queue: Yury Khmel <khmel@google.com>
Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577184}
parent fa7f7249
......@@ -93,20 +93,19 @@ app_list::SearchModel* AppListControllerImpl::GetSearchModel() {
void AppListControllerImpl::AddItem(AppListItemMetadataPtr item_data) {
const std::string folder_id = item_data->folder_id;
if (folder_id.empty()) {
if (folder_id.empty())
model_.AddItem(CreateAppListItem(std::move(item_data)));
} else {
// When we're setting a whole model of a profile, each item may have its
// folder id set properly. However, |AppListModel::AddItemToFolder| requires
// the item to add is not in the target folder yet, and sets its folder id
// later. So we should clear the folder id here to avoid breaking checks.
item_data->folder_id.clear();
else
AddItemToFolder(std::move(item_data), folder_id);
}
}
void AppListControllerImpl::AddItemToFolder(AppListItemMetadataPtr item_data,
const std::string& folder_id) {
// When we're setting a whole model of a profile, each item may have its
// folder id set properly. However, |AppListModel::AddItemToFolder| requires
// the item to add is not in the target folder yet, and sets its folder id
// later. So we should clear the folder id here to avoid breaking checks.
item_data->folder_id.clear();
model_.AddItemToFolder(CreateAppListItem(std::move(item_data)), folder_id);
}
......
......@@ -38,7 +38,7 @@ CrostiniAppItem::CrostiniAppItem(
// Crostini app is created from scratch. Move it to default folder.
DCHECK(folder_id().empty());
SetFolderId(kCrostiniFolderId);
SetChromeFolderId(kCrostiniFolderId);
}
// Set model updater last to avoid being called during construction.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment