Print Preview crash when accessing print engine data before it's fully created. b=365003 r=sharparrow1 sr=roc

This commit is contained in:
mats.palmgren%bredband.net 2007-01-01 10:53:11 +00:00
Родитель 066c866862
Коммит bf6cb32b34
1 изменённых файлов: 9 добавлений и 5 удалений

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

@ -1876,9 +1876,10 @@ DocumentViewerImpl::SetBounds(const nsRect& aBounds)
mPreviousViewer->SetBounds(aBounds); mPreviousViewer->SetBounds(aBounds);
#if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW) #if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
if (GetIsPrintPreview()) { if (GetIsPrintPreview() && !mPrintEngine->GetIsCreatingPrintPreview()) {
mPrintEngine->GetPrintPreviewWindow()->Resize(aBounds.x, aBounds.y, aBounds.width, aBounds.height, mPrintEngine->GetPrintPreviewWindow()->Resize(aBounds.x, aBounds.y,
PR_FALSE); aBounds.width, aBounds.height,
PR_FALSE);
} }
#endif #endif
return NS_OK; return NS_OK;
@ -3589,11 +3590,14 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
NS_IMETHODIMP NS_IMETHODIMP
DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum)
{ {
if (!GetIsPrintPreview()) return NS_ERROR_FAILURE; if (!GetIsPrintPreview() ||
mPrintEngine->GetIsCreatingPrintPreview())
return NS_ERROR_FAILURE;
nsIScrollableView* scrollableView = nsnull; nsIScrollableView* scrollableView = nsnull;
mPrintEngine->GetPrintPreviewViewManager()->GetRootScrollableView(&scrollableView); mPrintEngine->GetPrintPreviewViewManager()->GetRootScrollableView(&scrollableView);
if (scrollableView == nsnull) return NS_OK; if (scrollableView == nsnull)
return NS_OK;
// Check to see if we can short circut scrolling to the top // Check to see if we can short circut scrolling to the top
if (aType == nsIWebBrowserPrint::PRINTPREVIEW_HOME || if (aType == nsIWebBrowserPrint::PRINTPREVIEW_HOME ||