From 958307f8acecde8d13f45bd47b6368a278b1bda6 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Thu, 22 Feb 2018 12:11:53 -0500 Subject: Bug 1437087 - Call Disconnect on Unlink of cycle collector. r=masayuki, a=RyanVM --- editor/libeditor/EditorBase.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'editor') diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index b793f39b8..0c4a2a41d 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -175,7 +175,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(EditorBase) NS_IMPL_CYCLE_COLLECTION_UNLINK(mEditorObservers) NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocStateListeners) NS_IMPL_CYCLE_COLLECTION_UNLINK(mEventTarget) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mEventListener) + + if (tmp->mEventListener) { + EditorEventListener* listener = + reinterpret_cast(tmp->mEventListener.get()); + listener->Disconnect(); + tmp->mEventListener = nullptr; + } + NS_IMPL_CYCLE_COLLECTION_UNLINK(mSavedSel); NS_IMPL_CYCLE_COLLECTION_UNLINK(mRangeUpdater); NS_IMPL_CYCLE_COLLECTION_UNLINK_END -- cgit v1.2.3