Commit 8730bf66 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: Factor out the code to release the delegate interfaces.

parent af8bb2e9
...@@ -420,6 +420,25 @@ static HRESULT WINAPI DefaultHandler_SetHostNames( ...@@ -420,6 +420,25 @@ static HRESULT WINAPI DefaultHandler_SetHostNames(
return S_OK; return S_OK;
} }
static void release_delegates(DefaultHandler *This)
{
if (This->pDataDelegate)
{
IDataObject_Release(This->pDataDelegate);
This->pDataDelegate = NULL;
}
if (This->pPSDelegate)
{
IPersistStorage_Release(This->pPSDelegate);
This->pPSDelegate = NULL;
}
if (This->pOleDelegate)
{
IOleObject_Release(This->pOleDelegate);
This->pOleDelegate = NULL;
}
}
/* undoes the work done by DefaultHandler_Run */ /* undoes the work done by DefaultHandler_Run */
static void DefaultHandler_Stop(DefaultHandler *This) static void DefaultHandler_Stop(DefaultHandler *This)
{ {
...@@ -432,18 +451,8 @@ static void DefaultHandler_Stop(DefaultHandler *This) ...@@ -432,18 +451,8 @@ static void DefaultHandler_Stop(DefaultHandler *This)
if (This->dataAdviseHolder) if (This->dataAdviseHolder)
DataAdviseHolder_OnDisconnect(This->dataAdviseHolder); DataAdviseHolder_OnDisconnect(This->dataAdviseHolder);
if (This->pDataDelegate)
{ release_delegates(This);
IDataObject_Release(This->pDataDelegate);
This->pDataDelegate = NULL;
}
if (This->pPSDelegate)
{
IPersistStorage_Release(This->pPSDelegate);
This->pPSDelegate = NULL;
}
IOleObject_Release(This->pOleDelegate);
This->pOleDelegate = NULL;
} }
/************************************************************************ /************************************************************************
......
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