зеркало из https://github.com/mozilla/gecko-dev.git
bug=41871
a=edburns r=ashuk This checkin makes it so CBrowserContainer is properly released. The problem was that the CBrowserContainer was still registered to the docShell as a listener. The solution was to call wcIBrowserContianer::RemoveAllListeners() in the WebShellInitContext deallocator.
This commit is contained in:
Родитель
088b27f24a
Коммит
1620d1fe1d
|
@ -103,12 +103,24 @@ CBrowserContainer::CBrowserContainer(nsIWebBrowser *pOwner, JNIEnv *env,
|
||||||
if (nsnull == gVm) { // declared in jni_util.h
|
if (nsnull == gVm) { // declared in jni_util.h
|
||||||
::util_GetJavaVM(env, &gVm); // save this vm reference away for the callback!
|
::util_GetJavaVM(env, &gVm); // save this vm reference away for the callback!
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CBrowserContainer::~CBrowserContainer()
|
CBrowserContainer::~CBrowserContainer()
|
||||||
{
|
{
|
||||||
|
m_pOwner = nsnull;
|
||||||
|
mJNIEnv = nsnull;
|
||||||
|
mInitContext = nsnull;
|
||||||
|
mDocTarget = nsnull;
|
||||||
|
mMouseTarget = nsnull;
|
||||||
|
mDomEventTarget = nsnull;
|
||||||
|
inverseDepth = -1;
|
||||||
|
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION_1_2);
|
||||||
|
if (properties) {
|
||||||
|
::util_DeleteGlobalRef(env, properties);
|
||||||
|
}
|
||||||
|
properties = nsnull;
|
||||||
|
currentDOMEvent = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsISHEntry.h"
|
#include "nsISHEntry.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
#include "nsIDocShellTreeItem.h"
|
||||||
|
|
||||||
#include "jni_util.h"
|
#include "jni_util.h"
|
||||||
|
|
||||||
|
@ -680,9 +681,29 @@ wsDeallocateInitContextEvent::handleEvent ()
|
||||||
}
|
}
|
||||||
|
|
||||||
mInitContext->parentHWnd = nsnull;
|
mInitContext->parentHWnd = nsnull;
|
||||||
// ((nsISupports *)mInitContext->docShell)->Release();
|
|
||||||
|
// make sure the webBrowser's contentListener doesn't have a ref to
|
||||||
|
// CBrowserContainer
|
||||||
|
mInitContext->webBrowser->SetParentURIContentListener(nsnull);
|
||||||
|
mInitContext->webBrowser = nsnull;
|
||||||
|
|
||||||
|
// make sure the webShell's container is set to null.
|
||||||
|
// get the webShell from the docShell
|
||||||
|
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mInitContext->docShell));
|
||||||
|
if (webShell) {
|
||||||
|
webShell->SetContainer(nsnull);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure the docShell's TreeOwner is set to null
|
||||||
|
// get the docShellTreeItem from the docShell
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mInitContext->docShell));
|
||||||
|
if (docShellAsItem) {
|
||||||
|
docShellAsItem->SetTreeOwner(nsnull);
|
||||||
|
}
|
||||||
|
|
||||||
|
mInitContext->docShell->SetDocLoaderObserver(nsnull);
|
||||||
|
|
||||||
mInitContext->docShell = nsnull;
|
mInitContext->docShell = nsnull;
|
||||||
// ((nsISupports *)mInitContext->webShell)->Release();
|
|
||||||
|
|
||||||
// PENDING(edburns): this is a leak. For some reason, webShell's
|
// PENDING(edburns): this is a leak. For some reason, webShell's
|
||||||
// refcount is two. I believe it should be one.
|
// refcount is two. I believe it should be one.
|
||||||
|
@ -710,6 +731,11 @@ wsDeallocateInitContextEvent::handleEvent ()
|
||||||
mInitContext->h = -1;
|
mInitContext->h = -1;
|
||||||
mInitContext->gtkWinPtr = nsnull;
|
mInitContext->gtkWinPtr = nsnull;
|
||||||
mInitContext->searchContext = nsnull;
|
mInitContext->searchContext = nsnull;
|
||||||
|
|
||||||
|
// make sure we aren't listening anymore. This needs to be done
|
||||||
|
// before currentDocument = nsnull
|
||||||
|
mInitContext->browserContainer->RemoveAllListeners();
|
||||||
|
|
||||||
mInitContext->currentDocument = nsnull;
|
mInitContext->currentDocument = nsnull;
|
||||||
mInitContext->propertiesClass = nsnull;
|
mInitContext->propertiesClass = nsnull;
|
||||||
mInitContext->browserContainer = nsnull;
|
mInitContext->browserContainer = nsnull;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче