diff options
| author | Paul Miller <paulmiller@google.com> | 2014-12-19 17:51:18 -0800 |
|---|---|---|
| committer | Paul Miller <paulmiller@google.com> | 2015-01-06 11:32:02 -0800 |
| commit | f6bf1d7b30078adf4fb26a89f3b5988954c3287c (patch) | |
| tree | 8f4269a9d2d11b5214791c000d90f2a6944a238d | |
| parent | 45c6ae56d969709e0969514fa219375561c2df38 (diff) | |
| download | frameworks_base-f6bf1d7b30078adf4fb26a89f3b5988954c3287c.zip frameworks_base-f6bf1d7b30078adf4fb26a89f3b5988954c3287c.tar.gz frameworks_base-f6bf1d7b30078adf4fb26a89f3b5988954c3287c.tar.bz2 | |
Fix crash on pasting text in a WebView
WindowDecorActionBar and Chrome's ContentViewCore each have their own ActionMode
reference. ActionModeImpl.finish() nulls WindowDecorActionBar's reference and
calls mCallback.onDestroyActionMode() to null ContentViewCore's reference. But
if the callback is deferred, there is a period when the ActionMode is finished
(and mCallback is null), but ContentViewCore doesn't know. ContentViewCore may
try to invalidate() the ActionMode, which will crash on the null mCallback.
Make ActionModeImpl more permissive so that calling invalidate() during this
period does nothing.
BUG:18758329
Change-Id: I407fa0e0cd3cffa217e165caed83130d44760316
| -rw-r--r-- | core/java/com/android/internal/app/WindowDecorActionBar.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/com/android/internal/app/WindowDecorActionBar.java b/core/java/com/android/internal/app/WindowDecorActionBar.java index d95f0e5..061b535 100644 --- a/core/java/com/android/internal/app/WindowDecorActionBar.java +++ b/core/java/com/android/internal/app/WindowDecorActionBar.java @@ -993,6 +993,13 @@ public class WindowDecorActionBar extends ActionBar implements @Override public void invalidate() { + if (mActionMode != this) { + // Not the active action mode - no-op. It's possible we are + // currently deferring onDestroy, so the app doesn't yet know we + // are going away and is trying to use us. That's also a no-op. + return; + } + mMenu.stopDispatchingItemsChanged(); try { mCallback.onPrepareActionMode(this, mMenu); |
