Commit afdaf434 authored by bcwhite's avatar bcwhite Committed by Commit bot

Increase safety of delayed-keyboard-dismiss to not call destroyed object.

BUG=413744

Review URL: https://codereview.chromium.org/611543002

Cr-Commit-Position: refs/heads/master@{#296973}
parent 0f5b5790
...@@ -74,15 +74,22 @@ public class ImeAdapter { ...@@ -74,15 +74,22 @@ public class ImeAdapter {
} }
private class DelayedDismissInput implements Runnable { private class DelayedDismissInput implements Runnable {
private final long mNativeImeAdapter; private long mNativeImeAdapter;
DelayedDismissInput(long nativeImeAdapter) { DelayedDismissInput(long nativeImeAdapter) {
mNativeImeAdapter = nativeImeAdapter; mNativeImeAdapter = nativeImeAdapter;
} }
// http://crbug.com/413744
void detach() {
mNativeImeAdapter = 0;
}
@Override @Override
public void run() { public void run() {
attach(mNativeImeAdapter, sTextInputTypeNone, sTextInputFlagNone); if (mNativeImeAdapter != 0) {
attach(mNativeImeAdapter, sTextInputTypeNone, sTextInputFlagNone);
}
dismissInput(true); dismissInput(true);
} }
} }
...@@ -693,7 +700,10 @@ public class ImeAdapter { ...@@ -693,7 +700,10 @@ public class ImeAdapter {
@CalledByNative @CalledByNative
void detach() { void detach() {
if (mDismissInput != null) mHandler.removeCallbacks(mDismissInput); if (mDismissInput != null) {
mHandler.removeCallbacks(mDismissInput);
mDismissInput.detach();
}
mNativeImeAdapterAndroid = 0; mNativeImeAdapterAndroid = 0;
mTextInputType = 0; mTextInputType = 0;
} }
......
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