Commit cc1d28e6 authored by Lei Tian's avatar Lei Tian Committed by Commit Bot

LayoutManager.onTabStateInitialized creashes when creating Handler not in UI thread

The crashe is because TabPersistentStore.mergeState() kicks off an
AsyncTask to restoreTabs and restoreTabs creates a Handler in
LayoutManager.onTabStateInitialized(). But the Handler is not created in
UI thread whose Looper is not created.

Bug: 778447
Change-Id: Ibad4993471c461c0df61903025211488f4e50328
Reviewed-on: https://chromium-review.googlesource.com/746025
Commit-Queue: Lei Tian <ltian@google.com>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513244}
parent dcffc143
...@@ -1188,7 +1188,11 @@ public class TabPersistentStore extends TabPersister { ...@@ -1188,7 +1188,11 @@ public class TabPersistentStore extends TabPersister {
} }
private void onStateLoaded() { private void onStateLoaded() {
if (mObserver != null) mObserver.onStateLoaded(); if (mObserver != null) {
// mergeState() starts an AsyncTask to call this and this calls
// onTabStateInitialized which should be called from the UI thread.
ThreadUtils.runOnUiThread( () -> mObserver.onStateLoaded() );
}
} }
private void loadNextTab() { private void loadNextTab() {
......
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