Skip to content

Commit

Permalink
Bug 1766764 - Make nsEditingSession::RemoveListenersAndControllers
Browse files Browse the repository at this point in the history
…forget the used listener if it succeeded removing it from the editor r=m_kato

Although it's called multiple times is odd that but it should not try to
remove same listener after once it succeeded doing it.  Note that the listener
is created before calling `AddTransactionListener` so that it should be no
problem to make it forget the removed listener.

Differential Revision: https://phabricator.services.mozilla.com/D144906
  • Loading branch information
masayuki-nakano committed May 2, 2022
1 parent a69f60f commit 75ab173
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions editor/composer/nsEditingSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,13 @@ void nsEditingSession::RemoveListenersAndControllers(
}

// Remove all the listeners
RefPtr<ComposerCommandsUpdater> composertCommandsUpdater =
std::move(mComposerCommandsUpdater);
MOZ_ASSERT(!mComposerCommandsUpdater);
aHTMLEditor->SetComposerCommandsUpdater(nullptr);
DebugOnly<bool> removedTransactionListener =
aHTMLEditor->RemoveTransactionListener(*mComposerCommandsUpdater);
NS_WARNING_ASSERTION(removedTransactionListener,
"Failed to remove transaction listener from the editor");
if (!aHTMLEditor->RemoveTransactionListener(*composertCommandsUpdater)) {
NS_WARNING("Failed to remove transaction listener from the editor");
}

// Remove editor controllers from the window now that we're not
// editing in that window any more.
Expand Down

0 comments on commit 75ab173

Please sign in to comment.