msxml3: Store IBinding in bsc.

This commit is contained in:
Piotr Caban 2008-07-08 20:54:51 +02:00 committed by Alexandre Julliard
parent 0f76b41809
commit 56e231a4e5

View File

@ -53,6 +53,8 @@ typedef struct {
const struct IBindStatusCallbackVtbl *lpVtbl; const struct IBindStatusCallbackVtbl *lpVtbl;
LONG ref; LONG ref;
IBinding *binding;
} bsc_t; } bsc_t;
static inline bsc_t *impl_from_IBindStatusCallback( IBindStatusCallback *iface ) static inline bsc_t *impl_from_IBindStatusCallback( IBindStatusCallback *iface )
@ -96,8 +98,11 @@ static ULONG WINAPI bsc_Release(
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
if(!ref) if(!ref) {
if(This->binding)
IBinding_Release(This->binding);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
}
return ref; return ref;
} }
@ -107,6 +112,13 @@ static HRESULT WINAPI bsc_OnStartBinding(
DWORD dwReserved, DWORD dwReserved,
IBinding* pib) IBinding* pib)
{ {
bsc_t *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
This->binding = pib;
IBindStatusCallback_AddRef(pib);
return S_OK; return S_OK;
} }
@ -139,6 +151,15 @@ static HRESULT WINAPI bsc_OnStopBinding(
HRESULT hresult, HRESULT hresult,
LPCWSTR szError) LPCWSTR szError)
{ {
bsc_t *This = impl_from_IBindStatusCallback(iface);
TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
if(This->binding) {
IBinding_Release(This->binding);
This->binding = NULL;
}
return S_OK; return S_OK;
} }
@ -191,6 +212,7 @@ static bsc_t *create_bsc(void)
bsc->lpVtbl = &bsc_vtbl; bsc->lpVtbl = &bsc_vtbl;
bsc->ref = 1; bsc->ref = 1;
bsc->binding = NULL;
return bsc; return bsc;
} }