Jacek Caban wrote:
@@ -181,15 +184,52 @@ static HRESULT WINAPI ConnectionPoint_Ad DWORD *pdwCookie) { ConnectionPoint *This = CONPOINT_THIS(iface);
- FIXME("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
- return E_NOTIMPL;
- IDispatch *disp;
- DWORD i;
- HRESULT hres;
- TRACE("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
- hres = IUnknown_QueryInterface(pUnkSink, &This->iid, (void**)&disp);
- if(FAILED(hres)) {
hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatch, (void**)&disp);
if(FAILED(hres))
return CONNECT_E_CANNOTCONNECT;
- }
- if(This->sinks) {
for(i=0; i<This->sinks_size; i++) {
if(!This->sinks[i])
break;
}
if(i == This->sinks_size)
This->sinks = HeapReAlloc(GetProcessHeap(), 0, This->sinks,
(++This->sinks_size)*sizeof(*This->sinks));
- }else {
This->sinks = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->sinks));
This->sinks_size = 1;
i = 0;
- }
- This->sinks[i] = disp;
- *pdwCookie = i+1;
- return S_OK;
}
I think you need to AddRef disp here and release it appropriately in both Unadvise and on the final release.
Robert Shearman wrote:
I think you need to AddRef disp here and release it appropriately in both Unadvise and on the final release.
You're right, I forgot to release it in Unadvise, but I don't have to AddRef disp here as I get it from QueryInterface. I'll send an updated patch.
Thanks, Jacek