urlmon: Fix ref counting.

This commit is contained in:
Jacek Caban 2006-01-09 17:20:04 +01:00 committed by Alexandre Julliard
parent 99306db99e
commit fdc130f753
1 changed files with 11 additions and 1 deletions

View File

@ -194,6 +194,8 @@ static ULONG WINAPI ProtocolStream_Release(IStream *iface)
if(!ref) { if(!ref) {
IInternetProtocol_Release(This->protocol); IInternetProtocol_Release(This->protocol);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
URLMON_UnlockModule();
} }
return ref; return ref;
@ -345,6 +347,8 @@ static ProtocolStream *create_stream(IInternetProtocol *protocol)
IInternetProtocol_AddRef(protocol); IInternetProtocol_AddRef(protocol);
ret->protocol = protocol; ret->protocol = protocol;
URLMON_LockModule();
return ret; return ret;
} }
@ -380,8 +384,10 @@ static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void
*ppv = SERVPROV(This); *ppv = SERVPROV(This);
} }
if(*ppv) if(*ppv) {
IBinding_AddRef(BINDING(This));
return S_OK; return S_OK;
}
WARN("Unsupported interface %s\n", debugstr_guid(riid)); WARN("Unsupported interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE; return E_NOINTERFACE;
@ -419,6 +425,8 @@ static ULONG WINAPI Binding_Release(IBinding *iface)
HeapFree(GetProcessHeap(), 0, This->url); HeapFree(GetProcessHeap(), 0, This->url);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
URLMON_UnlockModule();
} }
return ref; return ref;
@ -809,6 +817,8 @@ static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding *
return E_NOTIMPL; return E_NOTIMPL;
} }
URLMON_LockModule();
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Binding)); ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Binding));
ret->lpBindingVtbl = &BindingVtbl; ret->lpBindingVtbl = &BindingVtbl;