Commit a56a0eb0 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: Rewrite _Run() to return early on failure.

parent e6042cf6
...@@ -1330,26 +1330,30 @@ static HRESULT WINAPI DefaultHandler_Run( ...@@ -1330,26 +1330,30 @@ static HRESULT WINAPI DefaultHandler_Run(
This->object_state = object_state_running; This->object_state = object_state_running;
hr = IOleObject_Advise(This->pOleDelegate, &This->IAdviseSink_iface, &This->dwAdvConn); hr = IOleObject_Advise(This->pOleDelegate, &This->IAdviseSink_iface, &This->dwAdvConn);
if (FAILED(hr)) goto fail;
if (SUCCEEDED(hr) && This->clientSite) if (This->clientSite)
hr = IOleObject_SetClientSite(This->pOleDelegate, This->clientSite);
if (SUCCEEDED(hr))
{ {
IOleObject_QueryInterface(This->pOleDelegate, &IID_IPersistStorage, hr = IOleObject_SetClientSite(This->pOleDelegate, This->clientSite);
(void **)&This->pPSDelegate); if (FAILED(hr)) goto fail;
if (This->pPSDelegate)
{
if(This->storage_state == storage_state_initialised)
hr = IPersistStorage_InitNew(This->pPSDelegate, This->storage);
else if(This->storage_state == storage_state_loaded)
hr = IPersistStorage_Load(This->pPSDelegate, This->storage);
}
} }
if (SUCCEEDED(hr) && This->containerApp) hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IPersistStorage,
(void **)&This->pPSDelegate);
if (FAILED(hr)) goto fail;
if (This->storage_state == storage_state_initialised)
hr = IPersistStorage_InitNew(This->pPSDelegate, This->storage);
else if (This->storage_state == storage_state_loaded)
hr = IPersistStorage_Load(This->pPSDelegate, This->storage);
if (FAILED(hr)) goto fail;
if (This->containerApp)
{
hr = IOleObject_SetHostNames(This->pOleDelegate, This->containerApp, hr = IOleObject_SetHostNames(This->pOleDelegate, This->containerApp,
This->containerObj); This->containerObj);
if (FAILED(hr)) goto fail;
}
/* FIXME: do more stuff here: /* FIXME: do more stuff here:
* - IOleObject_GetMiscStatus * - IOleObject_GetMiscStatus
...@@ -1357,20 +1361,22 @@ static HRESULT WINAPI DefaultHandler_Run( ...@@ -1357,20 +1361,22 @@ static HRESULT WINAPI DefaultHandler_Run(
* - IOleCache_OnRun * - IOleCache_OnRun
*/ */
if (SUCCEEDED(hr)) hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IDataObject,
hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IDataObject, (void **)&This->pDataDelegate);
(void **)&This->pDataDelegate); if (FAILED(hr)) goto fail;
if (SUCCEEDED(hr) && This->dataAdviseHolder) if (This->dataAdviseHolder)
hr = DataAdviseHolder_OnConnect(This->dataAdviseHolder, This->pDataDelegate);
if (FAILED(hr))
{ {
DefaultHandler_Stop(This); hr = DataAdviseHolder_OnConnect(This->dataAdviseHolder, This->pDataDelegate);
release_delegates(This); if (FAILED(hr)) goto fail;
} }
return hr; return hr;
fail:
DefaultHandler_Stop(This);
release_delegates(This);
return hr;
} }
/************************************************************************ /************************************************************************
......
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