Bug 620158 - Crash while printing, r=mats, a=blocking

--HG--
extra : rebase_source : 9aab81626cf1d2e68f266a78ac4bbee780706067
This commit is contained in:
Olli Pettay 2011-01-14 14:27:31 +02:00
parent 84e289495a
commit f0c80d0185
2 changed files with 11 additions and 2 deletions

View File

@ -44,6 +44,7 @@
#include "nsGkAtoms.h"
#include "nsComponentManagerUtils.h"
#include "nsIDocShellTreeItem.h"
#include "nsIBaseWindow.h"
//---------------------------------------------------
//-- nsPrintObject Class Impl
@ -51,7 +52,7 @@
nsPrintObject::nsPrintObject() :
mContent(nsnull), mFrameType(eFrame), mParent(nsnull),
mHasBeenPrinted(PR_FALSE), mDontPrint(PR_TRUE), mPrintAsIs(PR_FALSE),
mSharedPresShell(PR_FALSE), mInvisible(PR_FALSE),
mSharedPresShell(PR_FALSE), mInvisible(PR_FALSE), mDidCreateDocShell(PR_FALSE),
mShrinkRatio(1.0), mZoomRatio(1.0)
{
}
@ -65,6 +66,12 @@ nsPrintObject::~nsPrintObject()
}
DestroyPresentation();
if (mDidCreateDocShell && mDocShell) {
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(mDocShell));
if (baseWin) {
baseWin->Destroy();
}
}
mDocShell = nsnull;
mTreeOwner = nsnull; // mTreeOwner must be released after mDocShell;
}
@ -86,6 +93,7 @@ nsPrintObject::Init(nsIDocShell* aDocShell, nsIDOMDocument* aDoc,
// Create a container docshell for printing.
mDocShell = do_CreateInstance("@mozilla.org/docshell;1");
NS_ENSURE_TRUE(mDocShell, NS_ERROR_OUT_OF_MEMORY);
mDidCreateDocShell = PR_TRUE;
nsCOMPtr<nsIDocShellTreeItem> newItem = do_QueryInterface(mDocShell);
newItem->SetItemType(itemType);
newItem->SetTreeOwner(mTreeOwner);

View File

@ -89,6 +89,7 @@ public:
PRPackedBool mSharedPresShell;
PRPackedBool mInvisible; // Indicates PO is set to not visible by CSS
PRPackedBool mPrintPreview;
PRPackedBool mDidCreateDocShell;
float mShrinkRatio;
float mZoomRatio;