mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 803853, make sure to not leak mRules, r=ehsan
This commit is contained in:
parent
ba6b429800
commit
3243bf0a89
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user