зеркало из https://github.com/mozilla/gecko-dev.git
Bug 830236 - Add re-entrancy protection in a few places to avoid destroying things twice. r=cam
This commit is contained in:
Родитель
e6b1bfa615
Коммит
b48fe04ebd
|
@ -4262,11 +4262,12 @@ nsDocumentViewer::OnDonePrinting()
|
|||
{
|
||||
#if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
|
||||
if (mPrintEngine) {
|
||||
nsRefPtr<nsPrintEngine> pe = mPrintEngine;
|
||||
mPrintEngine = nullptr;
|
||||
if (GetIsPrintPreview()) {
|
||||
mPrintEngine->DestroyPrintingData();
|
||||
pe->DestroyPrintingData();
|
||||
} else {
|
||||
mPrintEngine->Destroy();
|
||||
mPrintEngine = nullptr;
|
||||
pe->Destroy();
|
||||
}
|
||||
|
||||
// We are done printing, now cleanup
|
||||
|
|
|
@ -239,7 +239,8 @@ nsPrintEngine::nsPrintEngine() :
|
|||
mOldPrtPreview(nullptr),
|
||||
mDebugFile(nullptr),
|
||||
mLoadCounter(0),
|
||||
mDidLoadDataForPrinting(false)
|
||||
mDidLoadDataForPrinting(false),
|
||||
mIsDestroying(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -252,6 +253,11 @@ nsPrintEngine::~nsPrintEngine()
|
|||
//-------------------------------------------------------
|
||||
void nsPrintEngine::Destroy()
|
||||
{
|
||||
if (mIsDestroying) {
|
||||
return;
|
||||
}
|
||||
mIsDestroying = true;
|
||||
|
||||
if (mPrt) {
|
||||
delete mPrt;
|
||||
mPrt = nullptr;
|
||||
|
|
|
@ -280,6 +280,7 @@ protected:
|
|||
|
||||
int32_t mLoadCounter;
|
||||
bool mDidLoadDataForPrinting;
|
||||
bool mIsDestroying;
|
||||
|
||||
nsresult AfterNetworkPrint(bool aHandleError);
|
||||
|
||||
|
|
|
@ -113,10 +113,11 @@ nsPrintObject::DestroyPresentation()
|
|||
#endif
|
||||
mPresShell->EndObservingDocument();
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
mPresShell->Destroy();
|
||||
nsCOMPtr<nsIPresShell> shell = mPresShell;
|
||||
mPresShell = nullptr;
|
||||
shell->Destroy();
|
||||
}
|
||||
mPresContext = nullptr;
|
||||
mPresShell = nullptr;
|
||||
mViewManager = nullptr;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче