Bug 1122786 - Make nsTextEditorState::mTextListener an nsRefPtr; r=roc

This commit is contained in:
Ehsan Akhgari 2015-01-16 13:40:13 -05:00
parent 466b4b59b6
commit 2e58c3092f
2 changed files with 3 additions and 5 deletions

View File

@ -979,7 +979,6 @@ nsTextEditorState::nsTextEditorState(nsITextControlElement* aOwningElement)
: mTextCtrlElement(aOwningElement),
mRestoringSelection(nullptr),
mBoundFrame(nullptr),
mTextListener(nullptr),
mEverInited(false),
mEditorInitialized(false),
mInitializing(false),
@ -1012,7 +1011,7 @@ nsTextEditorState::Clear()
// for us.
DestroyEditor();
}
NS_IF_RELEASE(mTextListener);
mTextListener = nullptr;
}
void nsTextEditorState::Unlink()
@ -1125,8 +1124,8 @@ nsTextEditorState::BindToFrame(nsTextControlFrame* aFrame)
// Create a SelectionController
mSelCon = new nsTextInputSelectionImpl(frameSel, shell, rootNode);
MOZ_ASSERT(!mTextListener, "Should not overwrite the object");
mTextListener = new nsTextInputListener(mTextCtrlElement);
NS_ADDREF(mTextListener);
mTextListener->SetFrame(mBoundFrame);
mSelCon->SetDisplaySelection(nsISelectionController::SELECTION_ON);
@ -1647,7 +1646,6 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
TrustedEventsAtSystemGroupBubble());
}
NS_RELEASE(mTextListener);
mTextListener = nullptr;
}

View File

@ -276,7 +276,7 @@ private:
nsCOMPtr<mozilla::dom::Element> mRootNode;
nsCOMPtr<mozilla::dom::Element> mPlaceholderDiv;
nsTextControlFrame* mBoundFrame;
nsTextInputListener* mTextListener;
nsRefPtr<nsTextInputListener> mTextListener;
nsAutoPtr<nsCString> mValue;
nsRefPtr<nsAnonDivObserver> mMutationObserver;
mutable nsString mCachedValue; // Caches non-hard-wrapped value on a multiline control.