Try to fix some crashes from calling PresShell methods after Destroy() has called. Bug 235395, r+sr=roc.

git-svn-id: svn://10.0.0.236/trunk@153206 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%brianryner.com
2004-02-25 09:10:06 +00:00
parent a1a4593ee8
commit 80fe50d37f
2 changed files with 20 additions and 12 deletions

View File

@@ -1342,6 +1342,7 @@ protected:
PRPackedBool mDidInitialReflow;
PRPackedBool mIgnoreFrameDestruction;
PRPackedBool mStylesHaveChanged;
PRPackedBool mHaveShutDown;
nsIFrame* mCurrentEventFrame;
nsIContent* mCurrentEventContent;
@@ -1623,7 +1624,7 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
PresShell::~PresShell()
{
if (mStyleSet) {
if (!mHaveShutDown) {
NS_NOTREACHED("Someone did not call nsIPresShell::destroy");
Destroy();
}
@@ -1637,7 +1638,9 @@ PresShell::~PresShell()
mFirstCallbackEventRequest == nsnull &&
mLastCallbackEventRequest == nsnull,
"post-reflow queues not empty. This means we're leaking");
delete mFrameManager;
delete mStyleSet;
delete mFrameConstructor;
NS_IF_RELEASE(mCurrentEventContent);
@@ -1814,6 +1817,9 @@ PresShell::Destroy()
}
#endif
if (mHaveShutDown)
return NS_OK;
// If our paint suppression timer is still active, kill it.
if (mPaintSuppressionTimer) {
mPaintSuppressionTimer->Cancel();
@@ -1871,14 +1877,10 @@ PresShell::Destroy()
// Destroy the frame manager. This will destroy the frame hierarchy
if (mFrameManager) {
mFrameManager->Destroy();
delete mFrameManager;
mFrameManager = nsnull;
}
// Let the style set do its cleanup.
mStyleSet->Shutdown(mPresContext);
delete mStyleSet;
mStyleSet = nsnull;
// We hold a reference to the pres context, and it holds a weak link back
// to us. To avoid the pres context having a dangling reference, set its
@@ -1902,6 +1904,8 @@ PresShell::Destroy()
CancelAllReflowCommands();
KillResizeEventTimer();
mHaveShutDown = PR_TRUE;
return NS_OK;
}

View File

@@ -1342,6 +1342,7 @@ protected:
PRPackedBool mDidInitialReflow;
PRPackedBool mIgnoreFrameDestruction;
PRPackedBool mStylesHaveChanged;
PRPackedBool mHaveShutDown;
nsIFrame* mCurrentEventFrame;
nsIContent* mCurrentEventContent;
@@ -1623,7 +1624,7 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
PresShell::~PresShell()
{
if (mStyleSet) {
if (!mHaveShutDown) {
NS_NOTREACHED("Someone did not call nsIPresShell::destroy");
Destroy();
}
@@ -1637,7 +1638,9 @@ PresShell::~PresShell()
mFirstCallbackEventRequest == nsnull &&
mLastCallbackEventRequest == nsnull,
"post-reflow queues not empty. This means we're leaking");
delete mFrameManager;
delete mStyleSet;
delete mFrameConstructor;
NS_IF_RELEASE(mCurrentEventContent);
@@ -1814,6 +1817,9 @@ PresShell::Destroy()
}
#endif
if (mHaveShutDown)
return NS_OK;
// If our paint suppression timer is still active, kill it.
if (mPaintSuppressionTimer) {
mPaintSuppressionTimer->Cancel();
@@ -1871,14 +1877,10 @@ PresShell::Destroy()
// Destroy the frame manager. This will destroy the frame hierarchy
if (mFrameManager) {
mFrameManager->Destroy();
delete mFrameManager;
mFrameManager = nsnull;
}
// Let the style set do its cleanup.
mStyleSet->Shutdown(mPresContext);
delete mStyleSet;
mStyleSet = nsnull;
// We hold a reference to the pres context, and it holds a weak link back
// to us. To avoid the pres context having a dangling reference, set its
@@ -1902,6 +1904,8 @@ PresShell::Destroy()
CancelAllReflowCommands();
KillResizeEventTimer();
mHaveShutDown = PR_TRUE;
return NS_OK;
}