Jacek Caban : mshtml: Move cycle collection to detach_gecko_browser.

Alexandre Julliard julliard at winehq.org
Tue Mar 12 16:56:16 CDT 2019


Module: wine
Branch: master
Commit: 98db6a0d9b8fc95da3781ce8ea8ea36519866649
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=98db6a0d9b8fc95da3781ce8ea8ea36519866649

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar 12 16:10:10 2019 +0100

mshtml: Move cycle collection to detach_gecko_browser.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmldoc.c | 11 -----------
 dlls/mshtml/nsembed.c | 10 ++++++++++
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 56a8617..7820cdb 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -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;
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 397011a..86a8f31 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -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);
+    }
 }
 
 /*




More information about the wine-cvs mailing list