shdocvw: Moved DocHost client site releasing to separated function and release more interfaces in SetClientSite.

This commit is contained in:
Jacek Caban 2010-01-22 17:12:26 +01:00 committed by Alexandre Julliard
parent 4945a136dc
commit 8112b59c9e
3 changed files with 27 additions and 14 deletions

View File

@ -362,6 +362,29 @@ void deactivate_document(DocHost *This)
This->document = NULL;
}
void release_dochost_client(DocHost *This)
{
if(This->hwnd) {
DestroyWindow(This->hwnd);
This->hwnd = NULL;
}
if(This->hostui) {
IDocHostUIHandler_Release(This->hostui);
This->hostui = NULL;
}
if(This->client_disp) {
IDispatch_Release(This->client_disp);
This->client_disp = NULL;
}
if(This->frame) {
IOleInPlaceFrame_Release(This->frame);
This->frame = NULL;
}
}
#define OLECMD_THIS(iface) DEFINE_THIS(DocHost, OleCommandTarget, iface)
static HRESULT WINAPI ClOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
@ -744,11 +767,7 @@ void DocHost_Init(DocHost *This, IDispatch *disp)
void DocHost_Release(DocHost *This)
{
if(This->client_disp)
IDispatch_Release(This->client_disp);
if(This->frame)
IOleInPlaceFrame_Release(This->frame);
release_dochost_client(This);
DocHost_ClientSite_Release(This);
ConnectionPointContainer_Destroy(&This->cps);

View File

@ -292,10 +292,8 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
if(This->client == pClientSite)
return S_OK;
if(This->doc_host.hwnd) {
DestroyWindow(This->doc_host.hwnd);
This->doc_host.hwnd = NULL;
}
release_dochost_client(&This->doc_host);
if(This->shell_embedding_hwnd) {
DestroyWindow(This->shell_embedding_hwnd);
This->shell_embedding_hwnd = NULL;
@ -306,11 +304,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
This->inplace = NULL;
}
if(This->doc_host.hostui) {
IDocHostUIHandler_Release(This->doc_host.hostui);
This->doc_host.hostui = NULL;
}
if(This->client)
IOleClientSite_Release(This->client);

View File

@ -205,6 +205,7 @@ void WebBrowser_OleObject_Destroy(WebBrowser*);
void DocHost_Init(DocHost*,IDispatch*);
void DocHost_ClientSite_Init(DocHost*);
void DocHost_Frame_Init(DocHost*);
void release_dochost_client(DocHost*);
void DocHost_Release(DocHost*);
void DocHost_ClientSite_Release(DocHost*);