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
Родитель 48818b4848
Коммит 32633d8660
2 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -44,14 +44,15 @@
#include "nsGkAtoms.h"
#include "nsComponentManagerUtils.h"
#include "nsIDocShellTreeItem.h"
#include "nsIBaseWindow.h"
//---------------------------------------------------
//-- nsPrintObject Class Impl
//---------------------------------------------------
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);

Просмотреть файл

@ -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;