зеркало из https://github.com/mozilla/gecko-dev.git
Bug 803853, make sure to not leak mRules, r=ehsan
This commit is contained in:
Родитель
1022b1f72e
Коммит
194ec67167
|
@ -274,6 +274,9 @@ nsHTMLEditRules::Init(nsPlaintextEditor *aEditor)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLEditRules::DetachEditor()
|
||||
{
|
||||
if (mHTMLEditor) {
|
||||
mHTMLEditor->RemoveEditActionListener(this);
|
||||
}
|
||||
mHTMLEditor = nullptr;
|
||||
return nsTextEditRules::DetachEditor();
|
||||
}
|
||||
|
|
|
@ -484,6 +484,7 @@ nsHTMLEditor::SetFlags(uint32_t aFlags)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InitRules()
|
||||
{
|
||||
MOZ_ASSERT(!mRules);
|
||||
// instantiate the rules for the html editor
|
||||
mRules = new nsHTMLEditRules();
|
||||
return mRules->Init(static_cast<nsPlaintextEditor*>(this));
|
||||
|
|
|
@ -121,6 +121,10 @@ NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
|
|||
NS_ENSURE_TRUE(aDoc, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsresult res = NS_OK, rulesRes = NS_OK;
|
||||
if (mRules) {
|
||||
mRules->DetachEditor();
|
||||
mRules = nullptr;
|
||||
}
|
||||
|
||||
if (1)
|
||||
{
|
||||
|
@ -313,6 +317,7 @@ nsPlaintextEditor::UpdateMetaCharset(nsIDOMDocument* aDocument,
|
|||
|
||||
NS_IMETHODIMP nsPlaintextEditor::InitRules()
|
||||
{
|
||||
MOZ_ASSERT(!mRules);
|
||||
// instantiate the rules for this text editor
|
||||
mRules = new nsTextEditRules();
|
||||
return mRules->Init(this);
|
||||
|
|
Загрузка…
Ссылка в новой задаче