mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 830236 - Add re-entrancy protection in a few places to avoid destroying things twice. r=cam
This commit is contained in:
parent
c78dc46a87
commit
97f9bf1fe4
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user