summaryrefslogtreecommitdiff
path: root/layout
diff options
context:
space:
mode:
authorBob Owen <bobowencode@gmail.com>2018-01-12 10:17:36 +0000
committerwolfbeast <mcwerewolf@gmail.com>2018-03-14 10:54:03 +0100
commitf13ea6af5be4ca04ec113f8c852d59d90993baa2 (patch)
tree69b244c92108a3f6a431df11ddc64200df72989e /layout
parentc7816fd9ee2ad7701bcd4d4a1fa054111efd96d6 (diff)
downloaduxp-f13ea6af5be4ca04ec113f8c852d59d90993baa2.tar.gz
Bug 1426087 - Decrement nsDocumentViewer::mDestroyRefCount in a separate function. r=jwatt, a=RyanVM
--HG-- extra : source : 86d41b5efe074f6988085082df9ef537eee0813a extra : intermediate-source : ea406489f93a0a8fa05ff568acdff07ce6b118c4
Diffstat (limited to 'layout')
-rw-r--r--layout/base/nsDocumentViewer.cpp7
-rw-r--r--layout/base/nsIDocumentViewerPrint.h2
-rw-r--r--layout/printing/nsPagePrintTimer.cpp10
3 files changed, 10 insertions, 9 deletions
diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp
index 782ac332ce..137efb3cdb 100644
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1617,7 +1617,6 @@ nsDocumentViewer::Destroy()
// We also keep the viewer from being cached in session history, since
// we require all documents there to be sanitized.
if (mDestroyRefCount != 0) {
- --mDestroyRefCount;
return NS_OK;
}
@@ -4426,6 +4425,12 @@ nsDocumentViewer::IncrementDestroyRefCount()
++mDestroyRefCount;
}
+void
+nsDocumentViewer::DecrementDestroyRefCount()
+{
+ --mDestroyRefCount;
+}
+
//------------------------------------------------------------
#if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
diff --git a/layout/base/nsIDocumentViewerPrint.h b/layout/base/nsIDocumentViewerPrint.h
index 8bc2465a15..e3c397f3a3 100644
--- a/layout/base/nsIDocumentViewerPrint.h
+++ b/layout/base/nsIDocumentViewerPrint.h
@@ -41,6 +41,7 @@ public:
virtual mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) = 0;
virtual void IncrementDestroyRefCount() = 0;
+ virtual void DecrementDestroyRefCount() = 0;
virtual void ReturnToGalleyPresentation() = 0;
@@ -75,6 +76,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewerPrint,
bool GetIsPrintPreview() override; \
mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) override; \
void IncrementDestroyRefCount() override; \
+ void DecrementDestroyRefCount() override; \
void ReturnToGalleyPresentation() override; \
void OnDonePrinting() override; \
bool IsInitializedForPrintPreview() override; \
diff --git a/layout/printing/nsPagePrintTimer.cpp b/layout/printing/nsPagePrintTimer.cpp
index b56569a9a9..164b0469a0 100644
--- a/layout/printing/nsPagePrintTimer.cpp
+++ b/layout/printing/nsPagePrintTimer.cpp
@@ -14,14 +14,8 @@ NS_IMPL_ISUPPORTS_INHERITED(nsPagePrintTimer, mozilla::Runnable, nsITimerCallbac
nsPagePrintTimer::~nsPagePrintTimer()
{
- // "Destroy" the document viewer; this normally doesn't actually
- // destroy it because of the IncrementDestroyRefCount call below
- // XXX This is messy; the document viewer should use a single approach
- // to keep itself alive during printing
- nsCOMPtr<nsIContentViewer> cv(do_QueryInterface(mDocViewerPrint));
- if (cv) {
- cv->Destroy();
- }
+ // This matches the IncrementDestroyRefCount call in the constructor.
+ mDocViewerPrint->DecrementDestroyRefCount();
}
nsresult