mshtml: Move cycle collection to detach_gecko_browser.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-03-12 16:10:10 +01:00 committed by Alexandre Julliard
parent 96604df690
commit 98db6a0d9b
2 changed files with 10 additions and 11 deletions

View File

@ -5300,11 +5300,6 @@ static ULONG WINAPI HTMLDocumentObj_Release(IUnknown *iface)
TRACE("(%p) ref = %u\n", This, ref);
if(!ref) {
nsIDOMWindowUtils *window_utils = NULL;
if(This->basedoc.window && This->basedoc.window->nswindow)
get_nsinterface((nsISupports*)This->basedoc.window->nswindow, &IID_nsIDOMWindowUtils, (void**)&window_utils);
if(This->basedoc.doc_node) {
This->basedoc.doc_node->basedoc.doc_obj = NULL;
htmldoc_release(&This->basedoc.doc_node->basedoc);
@ -5344,12 +5339,6 @@ static ULONG WINAPI HTMLDocumentObj_Release(IUnknown *iface)
if(This->nscontainer)
detach_gecko_browser(This->nscontainer);
heap_free(This);
/* Force cycle collection */
if(window_utils) {
nsIDOMWindowUtils_CycleCollect(window_utils, NULL, 0);
nsIDOMWindowUtils_Release(window_utils);
}
}
return ref;

View File

@ -2181,11 +2181,15 @@ HRESULT create_gecko_browser(HTMLDocumentObj *doc, GeckoBrowser **_ret)
void detach_gecko_browser(GeckoBrowser *This)
{
nsIDOMWindowUtils *window_utils = NULL;
TRACE("(%p)\n", This);
This->doc = NULL;
if(This->content_window) {
get_nsinterface((nsISupports*)This->content_window->nswindow, &IID_nsIDOMWindowUtils, (void**)&window_utils);
IHTMLWindow2_Release(&This->content_window->base.IHTMLWindow2_iface);
This->content_window = NULL;
}
@ -2243,6 +2247,12 @@ void detach_gecko_browser(GeckoBrowser *This)
}
nsIWebBrowserChrome_Release(&This->nsIWebBrowserChrome_iface);
/* Force cycle collection */
if(window_utils) {
nsIDOMWindowUtils_CycleCollect(window_utils, NULL, 0);
nsIDOMWindowUtils_Release(window_utils);
}
}
/*