Bug 362734 - Crash [@ nsPrintEngine::DocumentReadyForPrinting] with testcase that sets print preview, then reloads the page, patch by Andrew Smith, r=sharparrow1, sr=roc (blocking1.9 bug)

This commit is contained in:
martijn.martijn@gmail.com 2007-09-04 14:44:42 -07:00
parent e91b602a57
commit a3a38445dd
3 changed files with 11 additions and 24 deletions

View File

@ -1464,6 +1464,14 @@ DocumentViewerImpl::Destroy()
#ifdef NS_PRINTING
if (mPrintEngine) {
#ifdef NS_PRINT_PREVIEW
PRBool doingPrintPreview;
mPrintEngine->GetDoingPrintPreview(&doingPrintPreview);
if (doingPrintPreview) {
mPrintEngine->FinishPrintPreview();
}
#endif
mPrintEngine->Destroy();
mPrintEngine = nsnull;
}
@ -3451,13 +3459,6 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
return rv;
}
/** ---------------------------------------------------
* See documentation above in the nsIContentViewerfile class definition
* @update 11/01/01 rods
*
* For a full and detailed understanding of the issues with
* PrintPreview: See the design spec that is attached to Bug 107562
*/
NS_IMETHODIMP
DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings,
nsIDOMWindow *aChildDOMWin,

View File

@ -712,13 +712,6 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
return CommonPrint(PR_FALSE, aPrintSettings, aWebProgressListener);
}
/** ---------------------------------------------------
* See documentation above in the nsIContentViewerfile class definition
* @update 11/01/01 rods
*
* For a full and detailed understanding of the issues with
* PrintPreview: See the design spec that is attached to Bug 107562
*/
NS_IMETHODIMP
nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings,
nsIDOMWindow *aChildDOMWin,
@ -2534,6 +2527,9 @@ void nsPrintEngine::SetIsPrinting(PRBool aIsPrinting)
if (mDocViewerPrint) {
mDocViewerPrint->SetIsPrinting(aIsPrinting);
}
if (mPrt && aIsPrinting) {
mPrt->mPreparingForPrint = PR_TRUE;
}
}
//---------------------------------------------------------------------

View File

@ -59,16 +59,6 @@ class nsIPageSequenceFrame;
//------------------------------------------------------------------------
// nsPrintEngine Class
//
// mPreparingForPrint - indicates that we have started Printing but
// have not gone to the timer to start printing the pages. It gets turned
// off right before we go to the timer.
//
// mDocWasToBeDestroyed - Gets set when "someone" tries to unload the document
// while we were prparing to Print. This typically happens if a user starts
// to print while a page is still loading. If they start printing and pause
// at the print dialog and then the page comes in, we then abort printing
// because the document is no longer stable.
//
//------------------------------------------------------------------------
class nsPrintEngine : public nsIObserver
{