Commit bc47b126 authored by Piotr Caban's avatar Piotr Caban Committed by Michael Stefaniuc

ieframe: Restore closed IOleClientSite in DoVerb.

Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org> (cherry picked from commit 17379dcd) Signed-off-by: 's avatarMichael Stefaniuc <mstefani@winehq.org>
parent 61752889
......@@ -189,6 +189,7 @@ struct WebBrowser {
INT version;
IOleClientSite *client;
IOleClientSite *client_closed;
IOleContainer *container;
IOleInPlaceSiteEx *inplace;
......
......@@ -292,6 +292,11 @@ static void release_client_site(WebBrowser *This)
This->client = NULL;
}
if(This->client_closed) {
IOleClientSite_Release(This->client_closed);
This->client_closed = NULL;
}
if(This->shell_embedding_hwnd) {
DestroyWindow(This->shell_embedding_hwnd);
This->shell_embedding_hwnd = NULL;
......@@ -460,6 +465,11 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
TRACE("(%p)->(%p)\n", This, pClientSite);
if(This->client_closed) {
IOleClientSite_Release(This->client_closed);
This->client_closed = NULL;
}
if(This->client == pClientSite)
return S_OK;
......@@ -549,6 +559,8 @@ static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szCont
static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
{
WebBrowser *This = impl_from_IOleObject(iface);
IOleClientSite *client;
HRESULT hres;
TRACE("(%p)->(%d)\n", This, dwSaveOption);
......@@ -569,7 +581,13 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
if(This->inplace)
IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace);
return IOleObject_SetClientSite(iface, NULL);
/* store old client site - we need to restore it in DoVerb */
client = This->client;
if(This->client)
IOleClientSite_AddRef(This->client);
hres = IOleObject_SetClientSite(iface, NULL);
This->client_closed = client;
return hres;
}
static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
......@@ -611,6 +629,14 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tag
TRACE("(%p)->(%d %p %p %d %p %s)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
wine_dbgstr_rect(lprcPosRect));
/* restore closed client site if we have one */
if(!This->client && This->client_closed) {
IOleClientSite *client = This->client_closed;
This->client_closed = NULL;
IOleObject_SetClientSite(iface, client);
IOleClientSite_Release(client);
}
switch (iVerb)
{
case OLEIVERB_SHOW:
......
......@@ -50,7 +50,7 @@ DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
#define SET_EXPECT(func) \
expect_ ## func = TRUE
do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
#define CHECK_EXPECT2(func) \
do { \
......@@ -70,6 +70,12 @@ DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define CHECK_NOT_CALLED(func) \
do { \
ok(!called_ ## func, "unexpected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define CLEAR_CALLED(func) \
expect_ ## func = called_ ## func = FALSE
......@@ -3634,19 +3640,25 @@ static void test_Close(IWebBrowser2 *wb, BOOL do_download)
hres = IOleObject_DoVerb(oo, OLEIVERB_HIDE, NULL, (IOleClientSite*)0xdeadbeef,
0, (HWND)0xdeadbeef, NULL);
ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
todo_wine CHECK_CALLED(GetContainer);
todo_wine CHECK_CALLED(Site_GetWindow);
todo_wine CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
todo_wine CHECK_CALLED(Invoke_AMBIENT_SILENT);
CHECK_CALLED(GetContainer);
CHECK_CALLED(Site_GetWindow);
CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
CHECK_CALLED(Invoke_AMBIENT_SILENT);
hres = IOleObject_GetClientSite(oo, &ocs);
ok(hres == S_OK, "hres = %x\n", hres);
todo_wine ok(ocs == &ClientSite, "ocs != &ClientSite\n");
ok(ocs == &ClientSite, "ocs != &ClientSite\n");
if(ocs)
IOleClientSite_Release(ocs);
SET_EXPECT(OnFocus_FALSE);
SET_EXPECT(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE);
SET_EXPECT(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_FALSE);
hres = IOleObject_Close(oo, OLECLOSE_NOSAVE);
ok(hres == S_OK, "OleObject_Close failed: %x\n", hres);
todo_wine CHECK_NOT_CALLED(OnFocus_FALSE);
todo_wine CHECK_NOT_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE);
todo_wine CHECK_NOT_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_FALSE);
test_close = FALSE;
IOleObject_Release(oo);
......
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