mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1761085 - Check for existence of mEngine in mozSpellChecker; r=smaug
With the changes to EditorSpellCheck::SetFallbackDictionary to use a promise chain to support calling either SetCurrentDictionaryFromList or SetCurrentDictionaries as required, it is now possible that RemoteSpellCheckEngineChild is destroyed by the time the second promise runs. During destruction, RemoteSpellCheckEngineChild calls mozSpellChecker::DeleteRemoteEngine, which sets mEngine to nullptr. This patch adds a nullptr check for mEngine in both SetCurrentDictionaryFromList and SetCurrentDictionaries. Differential Revision: https://phabricator.services.mozilla.com/D141983
This commit is contained in:
parent
7251e4d3f9
commit
37130e3638
@ -466,6 +466,11 @@ nsresult mozSpellChecker::SetCurrentDictionary(const nsCString& aDictionary) {
|
||||
RefPtr<GenericPromise> mozSpellChecker::SetCurrentDictionaries(
|
||||
const nsTArray<nsCString>& aDictionaries) {
|
||||
if (XRE_IsContentProcess()) {
|
||||
if (!mEngine) {
|
||||
mCurrentDictionaries.Clear();
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, __func__);
|
||||
}
|
||||
|
||||
// mCurrentDictionaries will be set by RemoteSpellCheckEngineChild
|
||||
return mEngine->SetCurrentDictionaries(aDictionaries);
|
||||
}
|
||||
@ -518,6 +523,11 @@ RefPtr<GenericPromise> mozSpellChecker::SetCurrentDictionaryFromList(
|
||||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
if (!mEngine) {
|
||||
mCurrentDictionaries.Clear();
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, __func__);
|
||||
}
|
||||
|
||||
// mCurrentDictionaries will be set by RemoteSpellCheckEngineChild
|
||||
return mEngine->SetCurrentDictionaryFromList(aList);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user