Commit 8112b59c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

shdocvw: Moved DocHost client site releasing to separated function and release…

shdocvw: Moved DocHost client site releasing to separated function and release more interfaces in SetClientSite.
parent 4945a136
...@@ -362,6 +362,29 @@ void deactivate_document(DocHost *This) ...@@ -362,6 +362,29 @@ void deactivate_document(DocHost *This)
This->document = NULL; 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) #define OLECMD_THIS(iface) DEFINE_THIS(DocHost, OleCommandTarget, iface)
static HRESULT WINAPI ClOleCommandTarget_QueryInterface(IOleCommandTarget *iface, static HRESULT WINAPI ClOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
...@@ -744,11 +767,7 @@ void DocHost_Init(DocHost *This, IDispatch *disp) ...@@ -744,11 +767,7 @@ void DocHost_Init(DocHost *This, IDispatch *disp)
void DocHost_Release(DocHost *This) void DocHost_Release(DocHost *This)
{ {
if(This->client_disp) release_dochost_client(This);
IDispatch_Release(This->client_disp);
if(This->frame)
IOleInPlaceFrame_Release(This->frame);
DocHost_ClientSite_Release(This); DocHost_ClientSite_Release(This);
ConnectionPointContainer_Destroy(&This->cps); ConnectionPointContainer_Destroy(&This->cps);
......
...@@ -292,10 +292,8 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE ...@@ -292,10 +292,8 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
if(This->client == pClientSite) if(This->client == pClientSite)
return S_OK; return S_OK;
if(This->doc_host.hwnd) { release_dochost_client(&This->doc_host);
DestroyWindow(This->doc_host.hwnd);
This->doc_host.hwnd = NULL;
}
if(This->shell_embedding_hwnd) { if(This->shell_embedding_hwnd) {
DestroyWindow(This->shell_embedding_hwnd); DestroyWindow(This->shell_embedding_hwnd);
This->shell_embedding_hwnd = NULL; This->shell_embedding_hwnd = NULL;
...@@ -306,11 +304,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE ...@@ -306,11 +304,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
This->inplace = NULL; This->inplace = NULL;
} }
if(This->doc_host.hostui) {
IDocHostUIHandler_Release(This->doc_host.hostui);
This->doc_host.hostui = NULL;
}
if(This->client) if(This->client)
IOleClientSite_Release(This->client); IOleClientSite_Release(This->client);
......
...@@ -205,6 +205,7 @@ void WebBrowser_OleObject_Destroy(WebBrowser*); ...@@ -205,6 +205,7 @@ void WebBrowser_OleObject_Destroy(WebBrowser*);
void DocHost_Init(DocHost*,IDispatch*); void DocHost_Init(DocHost*,IDispatch*);
void DocHost_ClientSite_Init(DocHost*); void DocHost_ClientSite_Init(DocHost*);
void DocHost_Frame_Init(DocHost*); void DocHost_Frame_Init(DocHost*);
void release_dochost_client(DocHost*);
void DocHost_Release(DocHost*); void DocHost_Release(DocHost*);
void DocHost_ClientSite_Release(DocHost*); void DocHost_ClientSite_Release(DocHost*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment