diff options
author | Bob Owen <bobowencode@gmail.com> | 2018-04-10 15:36:26 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-04-19 12:00:54 +0200 |
commit | f243b7b4af1242c2b80726e462bac045d70c37f0 (patch) | |
tree | d800f103f5ce66729e4f09628a01f3c96837fc8a /dom/ipc/ContentParent.cpp | |
parent | 8c9b42d0b95bafd3e4dacdc1ab21af4066cfcbd9 (diff) | |
download | UXP-f243b7b4af1242c2b80726e462bac045d70c37f0.tar UXP-f243b7b4af1242c2b80726e462bac045d70c37f0.tar.gz UXP-f243b7b4af1242c2b80726e462bac045d70c37f0.tar.lz UXP-f243b7b4af1242c2b80726e462bac045d70c37f0.tar.xz UXP-f243b7b4af1242c2b80726e462bac045d70c37f0.zip |
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/ContentParent.cpp')
-rw-r--r-- | dom/ipc/ContentParent.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 73621df22..286f1d851 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 |