зеркало из 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 defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
|
||||||
if (mPrintEngine) {
|
if (mPrintEngine) {
|
||||||
|
nsRefPtr<nsPrintEngine> pe = mPrintEngine;
|
||||||
|
mPrintEngine = nullptr;
|
||||||
if (GetIsPrintPreview()) {
|
if (GetIsPrintPreview()) {
|
||||||
mPrintEngine->DestroyPrintingData();
|
pe->DestroyPrintingData();
|
||||||
} else {
|
} else {
|
||||||
mPrintEngine->Destroy();
|
pe->Destroy();
|
||||||
mPrintEngine = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are done printing, now cleanup
|
// We are done printing, now cleanup
|
||||||
|
|
|
@ -239,7 +239,8 @@ nsPrintEngine::nsPrintEngine() :
|
||||||
mOldPrtPreview(nullptr),
|
mOldPrtPreview(nullptr),
|
||||||
mDebugFile(nullptr),
|
mDebugFile(nullptr),
|
||||||
mLoadCounter(0),
|
mLoadCounter(0),
|
||||||
mDidLoadDataForPrinting(false)
|
mDidLoadDataForPrinting(false),
|
||||||
|
mIsDestroying(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +253,11 @@ nsPrintEngine::~nsPrintEngine()
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
void nsPrintEngine::Destroy()
|
void nsPrintEngine::Destroy()
|
||||||
{
|
{
|
||||||
|
if (mIsDestroying) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mIsDestroying = true;
|
||||||
|
|
||||||
if (mPrt) {
|
if (mPrt) {
|
||||||
delete mPrt;
|
delete mPrt;
|
||||||
mPrt = nullptr;
|
mPrt = nullptr;
|
||||||
|
|
|
@ -280,6 +280,7 @@ protected:
|
||||||
|
|
||||||
int32_t mLoadCounter;
|
int32_t mLoadCounter;
|
||||||
bool mDidLoadDataForPrinting;
|
bool mDidLoadDataForPrinting;
|
||||||
|
bool mIsDestroying;
|
||||||
|
|
||||||
nsresult AfterNetworkPrint(bool aHandleError);
|
nsresult AfterNetworkPrint(bool aHandleError);
|
||||||
|
|
||||||
|
|
|
@ -113,10 +113,11 @@ nsPrintObject::DestroyPresentation()
|
||||||
#endif
|
#endif
|
||||||
mPresShell->EndObservingDocument();
|
mPresShell->EndObservingDocument();
|
||||||
nsAutoScriptBlocker scriptBlocker;
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
mPresShell->Destroy();
|
nsCOMPtr<nsIPresShell> shell = mPresShell;
|
||||||
|
mPresShell = nullptr;
|
||||||
|
shell->Destroy();
|
||||||
}
|
}
|
||||||
mPresContext = nullptr;
|
mPresContext = nullptr;
|
||||||
mPresShell = nullptr;
|
|
||||||
mViewManager = nullptr;
|
mViewManager = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче