summaryrefslogtreecommitdiff
path: root/dom/ipc
diff options
context:
space:
mode:
authorBob Owen <bobowencode@gmail.com>2018-04-10 15:36:26 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-04-19 12:00:54 +0200
commit2bc9127d72be8a42de7219d62ae240e764c0a6ab (patch)
treed800f103f5ce66729e4f09628a01f3c96837fc8a /dom/ipc
parent8e16c2e3533e2c2b95a2f6d7d900697e2e6a7a9b (diff)
downloaduxp-2bc9127d72be8a42de7219d62ae240e764c0a6ab.tar.gz
Bug 1451376 - Properly enforce single PrintingParent per content process. r=jld, a=RyanVM
--HG-- extra : source : 6e0fe40d8a55a986a26844393853722824918ffe extra : intermediate-source : 8364f4c4f877f5edfb03ddf1304840b9f2cf7b11
Diffstat (limited to 'dom/ipc')
-rw-r--r--dom/ipc/ContentParent.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
index 73621df22d..286f1d851e 100644
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3224,11 +3224,15 @@ PPrintingParent*
ContentParent::AllocPPrintingParent()
{
#ifdef NS_PRINTING
- MOZ_ASSERT(!mPrintingParent,
- "Only one PrintingParent should be created per process.");
+ MOZ_RELEASE_ASSERT(!mPrintingParent,
+ "Only one PrintingParent should be created per process.");
// Create the printing singleton for this process.
mPrintingParent = new PrintingParent();
+
+ // Take another reference for IPDL code.
+ mPrintingParent.get()->AddRef();
+
return mPrintingParent.get();
#else
MOZ_ASSERT_UNREACHABLE("Should never be created if no printing.");
@@ -3240,8 +3244,11 @@ bool
ContentParent::DeallocPPrintingParent(PPrintingParent* printing)
{
#ifdef NS_PRINTING
- MOZ_ASSERT(mPrintingParent == printing,
- "Only one PrintingParent should have been created per process.");
+ MOZ_RELEASE_ASSERT(mPrintingParent == printing,
+ "Only one PrintingParent should have been created per process.");
+
+ // Release reference taken for IPDL code.
+ static_cast<PrintingParent*>(printing)->Release();
mPrintingParent = nullptr;
#else