From 0b43e267f446ad96a70aa6bd1c37dea6a40f573f Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Fri, 26 Sep 2008 12:51:42 +0300 Subject: [PATCH] Bug 433132, Running mochitest for bug 396024 still leaks r+sr=roc --- layout/base/nsDocumentViewer.cpp | 3 --- layout/printing/nsPrintEngine.cpp | 5 ++--- layout/printing/nsPrintEngine.h | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index f0a8b108083..c0f4685e56c 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1313,10 +1313,8 @@ DocumentViewerImpl::Close(nsISHEntry *aSHEntry) // A Close was called while we were printing // so don't clear the ScriptGlobalObject // or clear the mDocument below - // Also, do an extra addref to keep the viewer from going away. if (mPrintEngine && !mClosingWhilePrinting) { mClosingWhilePrinting = PR_TRUE; - NS_ADDREF_THIS(); } else #endif { @@ -4074,7 +4072,6 @@ DocumentViewerImpl::OnDonePrinting() mDocument = nsnull; } mClosingWhilePrinting = PR_FALSE; - NS_RELEASE_THIS(); } if (mPresContext) mPresContext->RestoreImageAnimationMode(); diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 7be7f22845f..02c7cde2f4d 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -229,7 +229,6 @@ nsPrintEngine::nsPrintEngine() : mIsDoingPrinting(PR_FALSE), mIsDoingPrintPreview(PR_FALSE), mProgressDialogIsShown(PR_FALSE), - mDocViewerPrint(nsnull), mContainer(nsnull), mDeviceContext(nsnull), mPrt(nsnull), @@ -269,7 +268,7 @@ void nsPrintEngine::Destroy() } #endif - + mDocViewerPrint = nsnull; } //------------------------------------------------------- @@ -299,7 +298,7 @@ nsresult nsPrintEngine::Initialize(nsIDocumentViewerPrint* aDocViewerPrint, NS_ENSURE_ARG_POINTER(aDevContext); NS_ENSURE_ARG_POINTER(aParentWidget); - mDocViewerPrint = aDocViewerPrint; // weak reference + mDocViewerPrint = aDocViewerPrint; mContainer = aContainer; // weak reference mDocument = aDocument; mDeviceContext = aDevContext; // weak reference diff --git a/layout/printing/nsPrintEngine.h b/layout/printing/nsPrintEngine.h index 613e1323e10..3fc5f39e77b 100644 --- a/layout/printing/nsPrintEngine.h +++ b/layout/printing/nsPrintEngine.h @@ -280,7 +280,7 @@ protected: PRPackedBool mIsDoingPrintPreview; // per DocumentViewer PRPackedBool mProgressDialogIsShown; - nsIDocumentViewerPrint* mDocViewerPrint; // [WEAK] it owns me! + nsCOMPtr mDocViewerPrint; nsISupports* mContainer; // [WEAK] it owns me! nsIDeviceContext* mDeviceContext; // not ref counted