mshtml: Fix ref counting.

- Fix ref counting.
- Use This->window instead of QI in NSContainer_Release.
This commit is contained in:
Jacek Caban 2006-04-08 19:49:55 +02:00 committed by Alexandre Julliard
parent f31b4e0394
commit 417c104760
2 changed files with 8 additions and 14 deletions

View File

@ -1115,6 +1115,7 @@ static nsresult NSAPI nsSupportsWeakReference_GetWeakReference(nsISupportsWeakRe
TRACE("(%p)->(%p)\n", This, _retval);
nsIWeakReference_AddRef(NSWEAKREF(This));
*_retval = NSWEAKREF(This);
return NS_OK;
}
@ -1230,23 +1231,13 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent)
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 *This)
nsIBaseWindow_Release(This->window);
This->window = NULL;
nsIWebBrowserFocus_Release(This->focus);
This->focus = NULL;
if(This->stream) {
nsIWebBrowserStream_Release(This->stream);
This->stream = NULL;

View File

@ -131,14 +131,13 @@ static BOOL handle_uri(NSContainer *container, nsChannel *channel, LPCWSTR uri)
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_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
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);