зеркало из https://github.com/mozilla/pjs.git
Memory leak fixes for bug 5870. r mjudge, a chofmann.
This commit is contained in:
Родитель
9a540c8daf
Коммит
d342f3f5fe
|
@ -304,9 +304,6 @@ nsEditor::nsEditor()
|
|||
|
||||
nsEditor::~nsEditor()
|
||||
{
|
||||
NS_IF_RELEASE(mPresShell);
|
||||
NS_IF_RELEASE(mViewManager);
|
||||
|
||||
if (mActionListeners)
|
||||
{
|
||||
PRInt32 i;
|
||||
|
@ -403,7 +400,7 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mDoc = aDoc;
|
||||
mPresShell = aPresShell;
|
||||
mPresShell = aPresShell; // we don't addref the pres shell
|
||||
mPresShell->GetViewManager(&mViewManager);
|
||||
if (mViewManager){
|
||||
mViewManager->Release(); //we want a weak link
|
||||
|
@ -2252,11 +2249,11 @@ void nsEditor::HACKForceRedraw()
|
|||
GetPresShell(getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIViewManager> viewmgr;
|
||||
nsCOMPtr<nsIView> view;
|
||||
|
||||
shell->GetViewManager(getter_AddRefs(viewmgr));
|
||||
if (viewmgr) {
|
||||
viewmgr->GetRootView(*getter_AddRefs(view));
|
||||
nsIView* view;
|
||||
viewmgr->GetRootView(view); // views are not refCounted
|
||||
if (view) {
|
||||
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
|
|
|
@ -1087,7 +1087,6 @@ nsHTMLEditRules::GetEndNodeAndOffset(nsIDOMSelection *aSelection,
|
|||
nsresult
|
||||
nsHTMLEditRules::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
||||
{
|
||||
nsIPresShell* shell = nsnull;
|
||||
nsresult result;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
nsIFrame *frame;
|
||||
|
@ -1097,7 +1096,8 @@ nsHTMLEditRules::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
|||
|
||||
if (!aResult || !content) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
result = mEditor->GetPresShell(&shell);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
result = mEditor->GetPresShell(getter_AddRefs(shell));
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
result = shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
|
|
@ -961,10 +961,10 @@ NS_IMETHODIMP nsTextEditor::OutputText(nsIOutputStream* aOutputStream, nsString*
|
|||
NS_IMETHODIMP nsTextEditor::OutputText(nsIOutputStream* aOutputStream, nsString* aOutputString, nsString* aCharsetOverride)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIPresShell* shell = nsnull;
|
||||
|
||||
GetPresShell(&shell);
|
||||
if (nsnull != shell) {
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
GetPresShell(getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
|
@ -1017,7 +1017,6 @@ NS_IMETHODIMP nsTextEditor::OutputText(nsIOutputStream* aOutputStream, nsString*
|
|||
}
|
||||
}
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1038,10 +1037,9 @@ NS_IMETHODIMP nsTextEditor::OutputHTML(nsIOutputStream* aOutputStream, nsString*
|
|||
{
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIPresShell* shell = nsnull;
|
||||
|
||||
GetPresShell(&shell);
|
||||
if (nsnull != shell) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
GetPresShell(getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
|
|
|
@ -304,9 +304,6 @@ nsEditor::nsEditor()
|
|||
|
||||
nsEditor::~nsEditor()
|
||||
{
|
||||
NS_IF_RELEASE(mPresShell);
|
||||
NS_IF_RELEASE(mViewManager);
|
||||
|
||||
if (mActionListeners)
|
||||
{
|
||||
PRInt32 i;
|
||||
|
@ -403,7 +400,7 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mDoc = aDoc;
|
||||
mPresShell = aPresShell;
|
||||
mPresShell = aPresShell; // we don't addref the pres shell
|
||||
mPresShell->GetViewManager(&mViewManager);
|
||||
if (mViewManager){
|
||||
mViewManager->Release(); //we want a weak link
|
||||
|
@ -2252,11 +2249,11 @@ void nsEditor::HACKForceRedraw()
|
|||
GetPresShell(getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIViewManager> viewmgr;
|
||||
nsCOMPtr<nsIView> view;
|
||||
|
||||
shell->GetViewManager(getter_AddRefs(viewmgr));
|
||||
if (viewmgr) {
|
||||
viewmgr->GetRootView(*getter_AddRefs(view));
|
||||
nsIView* view;
|
||||
viewmgr->GetRootView(view); // views are not refCounted
|
||||
if (view) {
|
||||
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
|
|
|
@ -1087,7 +1087,6 @@ nsHTMLEditRules::GetEndNodeAndOffset(nsIDOMSelection *aSelection,
|
|||
nsresult
|
||||
nsHTMLEditRules::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
||||
{
|
||||
nsIPresShell* shell = nsnull;
|
||||
nsresult result;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
nsIFrame *frame;
|
||||
|
@ -1097,7 +1096,8 @@ nsHTMLEditRules::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
|||
|
||||
if (!aResult || !content) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
result = mEditor->GetPresShell(&shell);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
result = mEditor->GetPresShell(getter_AddRefs(shell));
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
result = shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
|
Загрузка…
Ссылка в новой задаче