Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Unified Diff: components/spellcheck/browser/spellcheck_message_filter_platform_android.cc

Issue 2384613002: [Android] Fix spellcheck JNI crash when a tab is closed. (Closed)
Patch Set: more fixes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/spellcheck/browser/spellcheck_message_filter_platform_android.cc
diff --git a/components/spellcheck/browser/spellcheck_message_filter_platform_android.cc b/components/spellcheck/browser/spellcheck_message_filter_platform_android.cc
index 50a0e5a2d9b7b750ba7639e915a6a7847687b18c..ed3c41e3c8d006a0f0595f09b9a45cba73fbeb51 100644
--- a/components/spellcheck/browser/spellcheck_message_filter_platform_android.cc
+++ b/components/spellcheck/browser/spellcheck_message_filter_platform_android.cc
@@ -19,8 +19,14 @@ SpellCheckMessageFilterPlatform::SpellCheckMessageFilterPlatform(
void SpellCheckMessageFilterPlatform::OverrideThreadForMessage(
const IPC::Message& message, BrowserThread::ID* thread) {
- if (message.type() == SpellCheckHostMsg_RequestTextCheck::ID)
- *thread = BrowserThread::UI;
+ switch (message.type()) {
+ case SpellCheckHostMsg_RequestTextCheck::ID:
+ case SpellCheckHostMsg_ToggleSpellCheck::ID:
+ *thread = BrowserThread::UI;
+ break;
+ default:
+ break;
+ }
}
bool SpellCheckMessageFilterPlatform::OnMessageReceived(
@@ -91,3 +97,9 @@ void SpellCheckMessageFilterPlatform::OnToggleSpellCheck(
if (!enabled)
impl_->DisconnectSession();
}
+
+void SpellCheckMessageFilterPlatform::OnDestruct() const {
+ // Needs to be destroyed on the UI thread, to avoid race conditions
+ // on the java side during clean-up.
+ BrowserThread::DeleteOnUIThread::Destruct(this);
+}

Powered by Google App Engine
This is Rietveld 408576698