Commit 22c97cd9 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Implement a Stop function and use this to properly implement

IOleObject_Close, IAdviseSink_OnClose and the destructor.
parent 5c2a708d
...@@ -394,6 +394,25 @@ static HRESULT WINAPI DefaultHandler_SetHostNames( ...@@ -394,6 +394,25 @@ static HRESULT WINAPI DefaultHandler_SetHostNames(
return S_OK; return S_OK;
} }
/* undos the work done by DefaultHandler_Run */
static void WINAPI DefaultHandler_Stop(DefaultHandler *This)
{
if (!This->pOleDelegate)
return;
IOleObject_Unadvise(This->pOleDelegate, This->dwAdvConn);
/* FIXME: call IOleCache_OnStop */
if (This->pPSDelegate)
{
IPersistStorage_Release(This->pPSDelegate);
This->pPSDelegate = NULL;
}
IOleObject_Release(This->pOleDelegate);
This->pOleDelegate = NULL;
}
/************************************************************************ /************************************************************************
* DefaultHandler_Close (IOleObject) * DefaultHandler_Close (IOleObject)
* *
...@@ -406,8 +425,19 @@ static HRESULT WINAPI DefaultHandler_Close( ...@@ -406,8 +425,19 @@ static HRESULT WINAPI DefaultHandler_Close(
IOleObject* iface, IOleObject* iface,
DWORD dwSaveOption) DWORD dwSaveOption)
{ {
FIXME("()\n"); DefaultHandler *This = impl_from_IOleObject(iface);
HRESULT hr;
TRACE("(%ld)\n", dwSaveOption);
if (!This->pOleDelegate)
return S_OK; return S_OK;
hr = IOleObject_Close(This->pOleDelegate, dwSaveOption);
DefaultHandler_Stop(This);
return hr;
} }
/************************************************************************ /************************************************************************
...@@ -1204,7 +1234,7 @@ static HRESULT WINAPI DefaultHandler_Run( ...@@ -1204,7 +1234,7 @@ static HRESULT WINAPI DefaultHandler_Run(
/* FIXME: do more stuff here: /* FIXME: do more stuff here:
* - IOleObject_GetMiscStatus * - IOleObject_GetMiscStatus
* - IOleObject_GetMoniker * - IOleObject_GetMoniker
* - advise data cache that we've connected somehow? * - IOleCache_OnRun
*/ */
/* FIXME: if we failed, Close the object */ /* FIXME: if we failed, Close the object */
...@@ -1321,7 +1351,13 @@ static void WINAPI DefaultHandler_IAdviseSink_OnSave( ...@@ -1321,7 +1351,13 @@ static void WINAPI DefaultHandler_IAdviseSink_OnSave(
static void WINAPI DefaultHandler_IAdviseSink_OnClose( static void WINAPI DefaultHandler_IAdviseSink_OnClose(
IAdviseSink *iface) IAdviseSink *iface)
{ {
FIXME(": stub\n"); DefaultHandler *This = impl_from_IAdviseSink(iface);
TRACE("()\n");
IOleAdviseHolder_SendOnClose(This->oleAdviseHolder);
DefaultHandler_Stop(This);
} }
/* /*
...@@ -1472,10 +1508,8 @@ static DefaultHandler* DefaultHandler_Construct( ...@@ -1472,10 +1508,8 @@ static DefaultHandler* DefaultHandler_Construct(
static void DefaultHandler_Destroy( static void DefaultHandler_Destroy(
DefaultHandler* This) DefaultHandler* This)
{ {
if (This->pOleDelegate) /* release delegates */
IOleObject_Release(This->pOleDelegate); DefaultHandler_Stop(This);
if (This->pPSDelegate)
IPersistStorage_Release(This->pPSDelegate);
/* Free the strings idenfitying the object */ /* Free the strings idenfitying the object */
HeapFree( GetProcessHeap(), 0, This->containerApp ); HeapFree( GetProcessHeap(), 0, This->containerApp );
......
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