diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 74f1b399f19..3a02416859c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -531,6 +531,7 @@ struct HTMLDocumentObj { IOleClientSite *client; IDocHostUIHandler *hostui; + IOleCommandTarget *client_cmdtrg; BOOL custom_hostui; IOleInPlaceSite *ipsite; IOleInPlaceFrame *frame; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 9532a82cd1b..1c6b80ca2b5 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1450,7 +1450,6 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result) { HTMLOuterWindow *outer_window; HTMLDocumentObj *doc; - IOleCommandTarget *olecmd; BOOL is_error_url; SAFEARRAY *sa; SAFEARRAYBOUND bound; @@ -1473,18 +1472,15 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result) if(FAILED(hres) || is_error_url) return; - hres = IOleClientSite_QueryInterface(doc->client, - &IID_IOleCommandTarget, (void**)&olecmd); + if(!doc->client_cmdtrg) if(FAILED(hres)) return; bound.lLbound = 0; bound.cElements = 8; sa = SafeArrayCreate(VT_VARIANT, 1, &bound); - if(!sa) { - IOleCommandTarget_Release(olecmd); + if(!sa) return; - } ind = 0; V_VT(&var) = VT_I4; @@ -1532,11 +1528,10 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result) V_ARRAY(&var) = sa; V_VT(&varOut) = VT_BOOL; V_BOOL(&varOut) = VARIANT_TRUE; - IOleCommandTarget_Exec(olecmd, &CGID_DocHostCmdPriv, 1, 0, &var, FAILED(hres)?NULL:&varOut); + IOleCommandTarget_Exec(doc->client_cmdtrg, &CGID_DocHostCmdPriv, 1, 0, &var, FAILED(hres)?NULL:&varOut); SysFreeString(unk); SafeArrayDestroy(sa); - IOleCommandTarget_Release(olecmd); } static HRESULT nsChannelBSC_stop_binding(BSCallback *bsc, HRESULT result) diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index 0a1f97c27c8..d62c306664d 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -231,6 +231,11 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite This->doc_obj->usermode = UNKNOWN_USERMODE; } + if(This->doc_obj->client_cmdtrg) { + IOleCommandTarget_Release(This->doc_obj->client_cmdtrg); + This->doc_obj->client_cmdtrg = NULL; + } + if(This->doc_obj->hostui && !This->doc_obj->custom_hostui) { IDocHostUIHandler_Release(This->doc_obj->hostui); This->doc_obj->hostui = NULL; @@ -319,6 +324,8 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite VARIANT var; OLECMD cmd = {OLECMDID_SETPROGRESSTEXT, 0}; + This->doc_obj->client_cmdtrg = cmdtrg; + if(!hostui_setup) { IDocObjectService *doc_object_service; IBrowserService *browser_service; @@ -361,8 +368,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL); IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL); - - IOleCommandTarget_Release(cmdtrg); } if(This->doc_obj->usermode == UNKNOWN_USERMODE)