зеркало из https://github.com/mozilla/gecko-dev.git
Make sure the Print Data is cleaned up when exiting PP
Bug 164384 r=pete sr=kin a=asa
This commit is contained in:
Родитель
d8dc25e270
Коммит
493c71a327
|
@ -3770,13 +3770,28 @@ DocumentViewerImpl::InstallNewPresentation()
|
|||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
// This called ONLY when printing has completed and the DV
|
||||
// is being notified that it should get rid of the PrintEngine.
|
||||
//
|
||||
// BUT, if we are in Print Preview then we want to ignore the
|
||||
// notification (we do not get rid of the PrintEngine)
|
||||
//
|
||||
// One small caveat:
|
||||
// This IS called from two places in this module for cleaning
|
||||
// up when an error occurred during the start up printing
|
||||
// and print preview
|
||||
//
|
||||
void
|
||||
DocumentViewerImpl::OnDonePrinting()
|
||||
{
|
||||
#if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
|
||||
if (mPrintEngine) {
|
||||
mPrintEngine->Destroy();
|
||||
NS_RELEASE(mPrintEngine);
|
||||
if (GetIsPrintPreview()) {
|
||||
mPrintEngine->DestroyPrintingData();
|
||||
} else {
|
||||
mPrintEngine->Destroy();
|
||||
NS_RELEASE(mPrintEngine);
|
||||
}
|
||||
}
|
||||
#endif // NS_PRINTING && NS_PRINT_PREVIEW
|
||||
}
|
||||
|
|
|
@ -316,6 +316,15 @@ void nsPrintEngine::Destroy()
|
|||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
void nsPrintEngine::DestroyPrintingData()
|
||||
{
|
||||
if (mPrt) {
|
||||
delete mPrt;
|
||||
mPrt = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
//-- Section: Methods needed by the DocViewer
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@ -2237,10 +2246,6 @@ nsresult nsPrintEngine::CleanupOnFailure(nsresult aResult, PRBool aIsPrinting)
|
|||
NS_RELEASE(mPagePrintTimer);
|
||||
}
|
||||
|
||||
//if (mPrt) {
|
||||
// delete mPrt;
|
||||
// mPrt = nsnull;
|
||||
//}
|
||||
SetIsPrinting(PR_FALSE);
|
||||
|
||||
/* cleanup done, let's fire-up an error dialog to notify the user
|
||||
|
|
|
@ -107,9 +107,10 @@ public:
|
|||
|
||||
|
||||
nsPrintEngine();
|
||||
~nsPrintEngine(); // non-virtual
|
||||
virtual ~nsPrintEngine();
|
||||
|
||||
void Destroy();
|
||||
void DestroyPrintingData();
|
||||
|
||||
nsresult Initialize(nsIDocumentViewer* aDocViewer,
|
||||
nsIDocumentViewerPrint* aDocViewerPrint,
|
||||
|
|
|
@ -3770,13 +3770,28 @@ DocumentViewerImpl::InstallNewPresentation()
|
|||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
// This called ONLY when printing has completed and the DV
|
||||
// is being notified that it should get rid of the PrintEngine.
|
||||
//
|
||||
// BUT, if we are in Print Preview then we want to ignore the
|
||||
// notification (we do not get rid of the PrintEngine)
|
||||
//
|
||||
// One small caveat:
|
||||
// This IS called from two places in this module for cleaning
|
||||
// up when an error occurred during the start up printing
|
||||
// and print preview
|
||||
//
|
||||
void
|
||||
DocumentViewerImpl::OnDonePrinting()
|
||||
{
|
||||
#if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
|
||||
if (mPrintEngine) {
|
||||
mPrintEngine->Destroy();
|
||||
NS_RELEASE(mPrintEngine);
|
||||
if (GetIsPrintPreview()) {
|
||||
mPrintEngine->DestroyPrintingData();
|
||||
} else {
|
||||
mPrintEngine->Destroy();
|
||||
NS_RELEASE(mPrintEngine);
|
||||
}
|
||||
}
|
||||
#endif // NS_PRINTING && NS_PRINT_PREVIEW
|
||||
}
|
||||
|
|
|
@ -316,6 +316,15 @@ void nsPrintEngine::Destroy()
|
|||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
void nsPrintEngine::DestroyPrintingData()
|
||||
{
|
||||
if (mPrt) {
|
||||
delete mPrt;
|
||||
mPrt = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
//-- Section: Methods needed by the DocViewer
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@ -2237,10 +2246,6 @@ nsresult nsPrintEngine::CleanupOnFailure(nsresult aResult, PRBool aIsPrinting)
|
|||
NS_RELEASE(mPagePrintTimer);
|
||||
}
|
||||
|
||||
//if (mPrt) {
|
||||
// delete mPrt;
|
||||
// mPrt = nsnull;
|
||||
//}
|
||||
SetIsPrinting(PR_FALSE);
|
||||
|
||||
/* cleanup done, let's fire-up an error dialog to notify the user
|
||||
|
|
|
@ -107,9 +107,10 @@ public:
|
|||
|
||||
|
||||
nsPrintEngine();
|
||||
~nsPrintEngine(); // non-virtual
|
||||
virtual ~nsPrintEngine();
|
||||
|
||||
void Destroy();
|
||||
void DestroyPrintingData();
|
||||
|
||||
nsresult Initialize(nsIDocumentViewer* aDocViewer,
|
||||
nsIDocumentViewerPrint* aDocViewerPrint,
|
||||
|
|
Загрузка…
Ссылка в новой задаче