Jacek Caban : mshtml: Fix ref counting.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 10 06:28:46 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 417c10476041079a20143314de5c49bdf2e4dafe
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=417c10476041079a20143314de5c49bdf2e4dafe

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Apr  8 19:49:55 2006 +0200

mshtml: Fix ref counting.

- Fix ref counting.
- Use This->window instead of QI in NSContainer_Release.

---

 dlls/mshtml/nsembed.c |   18 ++++++------------
 dlls/mshtml/nsio.c    |    4 ++--
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index a64f6a5..ddd030a 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -1115,6 +1115,7 @@ static nsresult NSAPI nsSupportsWeakRefe
 
     TRACE("(%p)->(%p)\n", This, _retval);
 
+    nsIWeakReference_AddRef(NSWEAKREF(This));
     *_retval = NSWEAKREF(This);
     return NS_OK;
 }
@@ -1230,23 +1231,13 @@ NSContainer *NSContainer_Create(HTMLDocu
 
 void NSContainer_Release(NSContainer *This)
 {
-    nsIBaseWindow *base_window;
-    nsresult nsres;
-
     TRACE("(%p)\n", This);
 
     ShowWindow(This->hwnd, SW_HIDE);
     SetParent(This->hwnd, NULL);
 
-    nsres = nsIWebBrowser_QueryInterface(This->webbrowser, &IID_nsIBaseWindow,
-                                         (void**)&base_window);
-    if(NS_SUCCEEDED(nsres)) {
-        nsIBaseWindow_SetVisibility(base_window, FALSE);
-        nsIBaseWindow_Destroy(base_window);
-        nsIBaseWindow_Release(base_window);
-    }else {
-        ERR("Could not get nsIBaseWindow interface: %08lx\n", nsres);
-    }
+    nsIBaseWindow_SetVisibility(This->window, FALSE);
+    nsIBaseWindow_Destroy(This->window);
 
     nsIWebBrowser_SetContainerWindow(This->webbrowser, NULL);
 
@@ -1259,6 +1250,9 @@ void NSContainer_Release(NSContainer *Th
     nsIBaseWindow_Release(This->window);
     This->window = NULL;
 
+    nsIWebBrowserFocus_Release(This->focus);
+    This->focus = NULL;
+
     if(This->stream) {
         nsIWebBrowserStream_Release(This->stream);
         This->stream = NULL;
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 51b3160..8af0bf5 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -131,14 +131,13 @@ static BOOL handle_uri(NSContainer *cont
 
         hres = IServiceProvider_QueryService(service_provider, &IID_IHlinkFrame,
                                              &IID_IHlinkFrame, (void**)&hlink_frame);
+        IServiceProvider_Release(service_provider);
         if(SUCCEEDED(hres)) {
             hlink_frame_navigate(doc, hlink_frame, uri, channel->post_data_stream, hlnf);
             IHlinkFrame_Release(hlink_frame);
 
             return FALSE;
         }
-
-        IServiceProvider_Release(service_provider);
     }
 
     return TRUE;
@@ -618,6 +617,7 @@ static nsresult NSAPI nsChannel_AsyncOpe
 
             nsres = nsIUploadChannel_SetUploadStream(upload_channel, This->post_data_stream,
                                                      &empty_string, -1);
+            nsIUploadChannel_Release(upload_channel);
             if(NS_FAILED(nsres))
                 WARN("SetUploadStream failed: %08lx\n", nsres);
 




More information about the wine-cvs mailing list