Bug 1765172 - Only call UnbindFromFrame if BindToFrame succeeded. r=layout-reviewers,jfkthame

Differential Revision: https://phabricator.services.mozilla.com/D146060
This commit is contained in:
Emilio Cobos Álvarez 2022-05-11 11:41:40 +00:00
parent fe8840f811
commit b608ad722d

View File

@ -142,12 +142,10 @@ void nsTextControlFrame::DestroyFrom(nsIFrame* aDestructRoot,
// Unbind the text editor state object from the frame. The editor will live
// on, but things like controllers will be released.
RefPtr<TextControlElement> textControlElement =
TextControlElement::FromNode(GetContent());
RefPtr textControlElement = TextControlElement::FromNode(GetContent());
MOZ_ASSERT(textControlElement);
textControlElement->UnbindFromFrame(this);
if (mMutationObserver) {
textControlElement->UnbindFromFrame(this);
mRootNode->RemoveMutationObserver(mMutationObserver);
mMutationObserver = nullptr;
}