diff --git a/editor/composer/nsEditingSession.cpp b/editor/composer/nsEditingSession.cpp index 7ea70ff329192..689c6fea7164b 100644 --- a/editor/composer/nsEditingSession.cpp +++ b/editor/composer/nsEditingSession.cpp @@ -441,11 +441,13 @@ void nsEditingSession::RemoveListenersAndControllers( } // Remove all the listeners + RefPtr composertCommandsUpdater = + std::move(mComposerCommandsUpdater); + MOZ_ASSERT(!mComposerCommandsUpdater); aHTMLEditor->SetComposerCommandsUpdater(nullptr); - DebugOnly 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.