Bug 1709976 - Remove selection listeners from shutting down PresShell. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D115839
This commit is contained in:
Eitan Isaacson 2021-06-08 22:21:05 +00:00
parent 2548bdf8e1
commit ebd42829f3

View File

@ -101,6 +101,24 @@ void SelectionManager::RemoveDocSelectionListener(PresShell* aPresShell) {
// selection.
Selection* spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
spellSel->RemoveSelectionListener(this);
if (mCurrCtrlNormalSel) {
if (mCurrCtrlNormalSel->GetPresShell() == aPresShell) {
// Remove 'this' registered as selection listener for the normal selection
// if we are removing listeners for its PresShell.
mCurrCtrlNormalSel->RemoveSelectionListener(this);
mCurrCtrlNormalSel = nullptr;
}
}
if (mCurrCtrlSpellSel) {
if (mCurrCtrlSpellSel->GetPresShell() == aPresShell) {
// Remove 'this' registered as selection listener for the spellcheck
// selection if we are removing listeners for its PresShell.
mCurrCtrlSpellSel->RemoveSelectionListener(this);
mCurrCtrlSpellSel = nullptr;
}
}
}
void SelectionManager::ProcessTextSelChangeEvent(AccEvent* aEvent) {