Added a Destroy() method which is called when the WebShell container is going away...

This commit is contained in:
rpotts%netscape.com 1998-07-29 10:49:01 +00:00
parent c22db3a910
commit df17a64406
3 changed files with 42 additions and 4 deletions

View File

@ -95,6 +95,7 @@ public:
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
@ -455,16 +456,33 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
NS_RELEASE(mInnerWindow);
}
else {
// Get rid of extra reference count
mWindow->Release();
mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent,
mDeviceContext, nsnull);
// Get rid of extra reference count
mWindow->Release();
}
done:
return rv;
}
NS_IMETHODIMP
nsWebShell::Destroy()
{
nsresult rv = NS_OK;
// Stop any URLs that are currently being loaded...
mDocLoader->Stop();
SetContainer(nsnull);
SetObserver(nsnull);
NS_IF_RELEASE(mContentViewer);
return rv;
}
NS_IMETHODIMP
nsWebShell::GetBounds(nsRect& aResult)
{

View File

@ -86,6 +86,8 @@ public:
const nsRect& aBounds,
nsScrollPreference aScrolling = nsScrollPreference_kAuto)=0;
NS_IMETHOD Destroy() = 0;
NS_IMETHOD GetBounds(nsRect& aResult) = 0;
NS_IMETHOD SetBounds(const nsRect& aBounds) = 0;

View File

@ -95,6 +95,7 @@ public:
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
@ -455,16 +456,33 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
NS_RELEASE(mInnerWindow);
}
else {
// Get rid of extra reference count
mWindow->Release();
mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent,
mDeviceContext, nsnull);
// Get rid of extra reference count
mWindow->Release();
}
done:
return rv;
}
NS_IMETHODIMP
nsWebShell::Destroy()
{
nsresult rv = NS_OK;
// Stop any URLs that are currently being loaded...
mDocLoader->Stop();
SetContainer(nsnull);
SetObserver(nsnull);
NS_IF_RELEASE(mContentViewer);
return rv;
}
NS_IMETHODIMP
nsWebShell::GetBounds(nsRect& aResult)
{