Commit 5de034ba authored by khmel@google.com's avatar khmel@google.com Committed by Commit Bot

app_list: Fix crash on app launcher opening.

This fix crash when App Launcher is opened next time and having results
for Answer Cards from the previous opening. This cleans search result on
App Launcher close and adds extra protection to prevent handling views
in Answer Cards not attached to the app list view.

TEST=Manually, no crash, no error reported
BUG=878987

Change-Id: I06fb0d8898161228b95a9001d2dc9b79690fe0c5
Reviewed-on: https://chromium-review.googlesource.com/1197328
Commit-Queue: Yury Khmel <khmel@google.com>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587851}
parent 62224a2b
...@@ -666,6 +666,9 @@ void AppListControllerImpl::ViewShown(int64_t display_id) { ...@@ -666,6 +666,9 @@ void AppListControllerImpl::ViewShown(int64_t display_id) {
} }
void AppListControllerImpl::ViewClosing() { void AppListControllerImpl::ViewClosing() {
// Clear results to prevent initializing the next app list view with outdated
// results.
presenter_.GetView()->search_box_view()->ClearSearch();
if (client_) if (client_)
client_->ViewClosing(); client_->ViewClosing();
} }
......
...@@ -1388,7 +1388,7 @@ void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty, ...@@ -1388,7 +1388,7 @@ void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty,
} }
break; break;
case AppListViewState::CLOSED: case AppListViewState::CLOSED:
NOTREACHED(); // We clean search on app list close.
break; break;
} }
} }
......
...@@ -77,6 +77,11 @@ void ExcludeCardFromEventHandling(gfx::NativeView card_native_view) { ...@@ -77,6 +77,11 @@ void ExcludeCardFromEventHandling(gfx::NativeView card_native_view) {
if (!card_native_view) if (!card_native_view)
return; return;
if (!card_native_view->parent()) {
LOG(ERROR) << "Card is not attached to the app list view.";
return;
}
// |card_native_view| is brought into View's hierarchy via a NativeViewHost. // |card_native_view| is brought into View's hierarchy via a NativeViewHost.
// The window hierarchy looks like this: // The window hierarchy looks like this:
// widget window -> clipping window -> content_native_view // widget window -> clipping window -> content_native_view
......
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