Make sure the Print Data is cleaned up when exiting PP

Bug 164384 r=pete sr=kin a=asa


git-svn-id: svn://10.0.0.236/trunk@129137 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods%netscape.com
2002-09-10 01:57:09 +00:00
parent aa9375bb5c
commit 4aff6cd832
6 changed files with 56 additions and 14 deletions

View File

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

View File

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

View File

@@ -107,9 +107,10 @@ public:
nsPrintEngine();
~nsPrintEngine(); // non-virtual
virtual ~nsPrintEngine();
void Destroy();
void DestroyPrintingData();
nsresult Initialize(nsIDocumentViewer* aDocViewer,
nsIDocumentViewerPrint* aDocViewerPrint,

View File

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

View File

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

View File

@@ -107,9 +107,10 @@ public:
nsPrintEngine();
~nsPrintEngine(); // non-virtual
virtual ~nsPrintEngine();
void Destroy();
void DestroyPrintingData();
nsresult Initialize(nsIDocumentViewer* aDocViewer,
nsIDocumentViewerPrint* aDocViewerPrint,