Chris Robinson : quartz: Release objects when pins fail to connect.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 19 08:17:40 CDT 2007
Module: wine
Branch: master
Commit: d8dc9fb319e48d23b72ea8d9fb286dc22888393b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d8dc9fb319e48d23b72ea8d9fb286dc22888393b
Author: Chris Robinson <chris.kcat at gmail.com>
Date: Wed Mar 14 06:42:37 2007 -0700
quartz: Release objects when pins fail to connect.
---
dlls/quartz/pin.c | 44 ++++++++++++++++++++++++++++++++------------
1 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c
index 28d461a..b3aa042 100644
--- a/dlls/quartz/pin.c
+++ b/dlls/quartz/pin.c
@@ -79,31 +79,40 @@ static HRESULT OutputPin_ConnectSpecific(IPin * iface, IPin * pReceivePin, const
* connected pin */
if (SUCCEEDED(hr))
{
+ This->pMemInputPin = NULL;
hr = IPin_QueryInterface(pReceivePin, &IID_IMemInputPin, (LPVOID)&This->pMemInputPin);
if (SUCCEEDED(hr))
- hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pMemAlloc);
-
- if (hr == VFW_E_NO_ALLOCATOR)
{
- /* Input pin provides no allocator, use standard memory allocator */
- hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (LPVOID*)&pMemAlloc);
+ hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pMemAlloc);
- if (SUCCEEDED(hr))
+ if (hr == VFW_E_NO_ALLOCATOR)
{
- hr = IMemInputPin_NotifyAllocator(This->pMemInputPin, pMemAlloc, FALSE);
+ /* Input pin provides no allocator, use standard memory allocator */
+ hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (LPVOID*)&pMemAlloc);
+
+ if (SUCCEEDED(hr))
+ {
+ hr = IMemInputPin_NotifyAllocator(This->pMemInputPin, pMemAlloc, FALSE);
+ }
}
- }
- if (SUCCEEDED(hr))
- hr = IMemAllocator_SetProperties(pMemAlloc, &This->allocProps, &actual);
+ if (SUCCEEDED(hr))
+ hr = IMemAllocator_SetProperties(pMemAlloc, &This->allocProps, &actual);
- if (pMemAlloc)
- IMemAllocator_Release(pMemAlloc);
+ if (pMemAlloc)
+ IMemAllocator_Release(pMemAlloc);
+ }
/* break connection if we couldn't get the allocator */
if (FAILED(hr))
+ {
+ if (This->pMemInputPin)
+ IMemInputPin_Release(This->pMemInputPin);
+ This->pMemInputPin = NULL;
+
IPin_Disconnect(pReceivePin);
+ }
}
if (FAILED(hr))
@@ -1069,6 +1078,8 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
}
}
+ This->pReader = NULL;
+ This->pAlloc = NULL;
if (SUCCEEDED(hr))
{
hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
@@ -1095,6 +1106,15 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
This->pin.pConnectedTo = pReceivePin;
IPin_AddRef(pReceivePin);
}
+ else
+ {
+ if (This->pReader)
+ IAsyncReader_Release(This->pReader);
+ This->pReader = NULL;
+ if (This->pAlloc)
+ IMemAllocator_Release(This->pAlloc);
+ This->pAlloc = NULL;
+ }
}
LeaveCriticalSection(This->pin.pCritSec);
return hr;
More information about the wine-cvs
mailing list