From 306bd05f993cf30364a052edacad76167ee1e39f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 22 Aug 2005 14:07:49 +0000 Subject: [PATCH] - Call LockContainer only if it's not already locked/unlocked. - Only return S_OK in SetClientSite if IOleClientSite is not changed. --- dlls/mshtml/mshtml_private.h | 3 +++ dlls/mshtml/oleobj.c | 38 ++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 3942831bce4..73b03af7841 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -66,6 +66,7 @@ typedef struct { BOOL ui_active; BOOL window_active; BOOL has_key_path; + BOOL container_locked; BindStatusCallback *status_callback; } HTMLDocument; @@ -111,6 +112,8 @@ void HTMLDocument_NSContainer_Init(HTMLDocument*); void HTMLDocument_NSContainer_Destroy(HTMLDocument*); +void HTMLDocument_LockContainer(HTMLDocument*,BOOL); + HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**); void close_gecko(void); diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index 16dfa9bf224..b356653b43e 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -70,6 +70,9 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite TRACE("(%p)->(%p)\n", This, pClientSite); + if(pClientSite == This->client) + return S_OK; + if(This->client) IOleClientSite_Release(This->client); @@ -190,7 +193,6 @@ static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szCont static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption) { HTMLDocument *This = OLEOBJ_THIS(iface); - HRESULT hres; TRACE("(%p)->(%08lx)\n", This, dwSaveOption); @@ -200,14 +202,7 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption) if(This->in_place_active) IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This)); - if(This->client) { - IOleContainer *container; - hres = IOleClientSite_GetContainer(This->client, &container); - if(SUCCEEDED(hres)) { - IOleContainer_LockContainer(container, FALSE); - IOleContainer_Release(container); - } - } + HTMLDocument_LockContainer(This, FALSE); return S_OK; } @@ -260,12 +255,8 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpms hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite); if(SUCCEEDED(hres)) { - IOleContainer *pContainer; - hres = IOleClientSite_GetContainer(pActiveSite, &pContainer); - if(SUCCEEDED(hres)) { - IOleContainer_LockContainer(pContainer, TRUE); - IOleContainer_Release(pContainer); - } + HTMLDocument_LockContainer(This, TRUE); + /* FIXME: Create new IOleDocumentView. See CreateView for more info. */ hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This)); IOleDocumentSite_Release(pDocSite); @@ -1003,6 +994,22 @@ static const IOleControlVtbl OleControlVtbl = { OleControl_FreezeEvents }; +void HTMLDocument_LockContainer(HTMLDocument *This, BOOL fLock) +{ + IOleContainer *container; + HRESULT hres; + + if(!This->client || This->container_locked == fLock) + return; + + hres = IOleClientSite_GetContainer(This->client, &container); + if(SUCCEEDED(hres)) { + IOleContainer_LockContainer(container, fLock); + This->container_locked = fLock; + IOleContainer_Release(container); + } +} + void HTMLDocument_OleObj_Init(HTMLDocument *This) { This->lpOleObjectVtbl = &OleObjectVtbl; @@ -1014,4 +1021,5 @@ void HTMLDocument_OleObj_Init(HTMLDocument *This) This->hostui = NULL; This->has_key_path = FALSE; + This->container_locked = FALSE; }