Fix for bug 6005, crash on window closing via script. A: chofmann, R: vidur

git-svn-id: svn://10.0.0.236/trunk@32427 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
joki%netscape.com
1999-05-20 23:16:53 +00:00
parent 518d3ab653
commit 91abaf6632
2 changed files with 26 additions and 0 deletions

View File

@@ -204,6 +204,7 @@ static NS_DEFINE_IID(kIXMLDocumentIID, NS_IXMLDOCUMENT_IID);
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
class PresShell : public nsIPresShell, public nsIViewObserver,
private nsIDocumentObserver, public nsIFocusTracker,
@@ -1981,6 +1982,17 @@ PresShell::HandleEvent(nsIView *aView,
frame = (nsIFrame *)clientData;
if (nsnull != frame) {
nsIWebShell* webShell = nsnull;
nsISupports* container;
mPresContext->GetContainer(&container);
if (nsnull != container) {
if (NS_OK != container->QueryInterface(kIWebShellIID, (void**)&webShell)) {
NS_ASSERTION(webShell, "No webshell to grab during event dispatch");
}
NS_RELEASE(container);
}
if (mSelection && aEvent->eventStructType == NS_KEY_EVENT)
{
mSelection->EnableFrameNotification(PR_FALSE);
@@ -2020,6 +2032,7 @@ PresShell::HandleEvent(nsIView *aView,
NS_RELEASE(manager);
}
}
NS_IF_RELEASE(webShell);
}
else {
rv = NS_OK;

View File

@@ -204,6 +204,7 @@ static NS_DEFINE_IID(kIXMLDocumentIID, NS_IXMLDOCUMENT_IID);
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
class PresShell : public nsIPresShell, public nsIViewObserver,
private nsIDocumentObserver, public nsIFocusTracker,
@@ -1981,6 +1982,17 @@ PresShell::HandleEvent(nsIView *aView,
frame = (nsIFrame *)clientData;
if (nsnull != frame) {
nsIWebShell* webShell = nsnull;
nsISupports* container;
mPresContext->GetContainer(&container);
if (nsnull != container) {
if (NS_OK != container->QueryInterface(kIWebShellIID, (void**)&webShell)) {
NS_ASSERTION(webShell, "No webshell to grab during event dispatch");
}
NS_RELEASE(container);
}
if (mSelection && aEvent->eventStructType == NS_KEY_EVENT)
{
mSelection->EnableFrameNotification(PR_FALSE);
@@ -2020,6 +2032,7 @@ PresShell::HandleEvent(nsIView *aView,
NS_RELEASE(manager);
}
}
NS_IF_RELEASE(webShell);
}
else {
rv = NS_OK;