| Index: components/spellcheck/browser/spellchecker_session_bridge_android.cc
|
| diff --git a/components/spellcheck/browser/spellchecker_session_bridge_android.cc b/components/spellcheck/browser/spellchecker_session_bridge_android.cc
|
| index a34425de098444ed442fa300d9765559c830c7e4..e935a9a87f4377d5cfae3fdec81da68975b1143f 100644
|
| --- a/components/spellcheck/browser/spellchecker_session_bridge_android.cc
|
| +++ b/components/spellcheck/browser/spellchecker_session_bridge_android.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/android/jni_string.h"
|
| #include "components/spellcheck/common/spellcheck_messages.h"
|
| #include "components/spellcheck/common/spellcheck_result.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/render_process_host.h"
|
| #include "jni/SpellCheckerSessionBridge_jni.h"
|
|
|
| @@ -20,7 +21,16 @@ SpellCheckerSessionBridge::SpellCheckerSessionBridge(int render_process_id)
|
| : render_process_id_(render_process_id),
|
| java_object_initialization_failed_(false) {}
|
|
|
| -SpellCheckerSessionBridge::~SpellCheckerSessionBridge() {}
|
| +SpellCheckerSessionBridge::~SpellCheckerSessionBridge() {
|
| + // Needs to be destroyed on the same thread as the RequestTextCheck and
|
| + // ProcessSpellCheckResults are executed, which is the UI thread.
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
| +
|
| + if (!java_object_.is_null()) {
|
| + Java_SpellCheckerSessionBridge_disconnect(
|
| + base::android::AttachCurrentThread(), java_object_);
|
| + }
|
| +}
|
|
|
| // static
|
| bool SpellCheckerSessionBridge::RegisterJNI(JNIEnv* env) {
|
|
|