[2/4] strmbase: Separate BasePin destructors from Release.

Thomas Faber thomas.faber at reactos.org
Sun Jul 27 09:46:59 CDT 2014


From eaa502463e84a17c6bd0ec5ffe79c0c11d0022bb Mon Sep 17 00:00:00 2001
From: Thomas Faber <thomas.faber at reactos.org>
Date: Sun, 27 Jul 2014 11:34:50 +0200
Subject: strmbase: Separate BasePin destructors from Release.

---
 dlls/strmbase/pin.c     | 34 +++++++++++++++++++++++-----------
 include/wine/strmbase.h |  2 ++
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index 4920784..02af5b3 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -401,11 +401,7 @@ ULONG WINAPI BaseOutputPinImpl_Release(IPin * iface)
 
     if (!refCount)
     {
-        FreeMediaType(&This->pin.mtCurrent);
-        if (This->pAllocator)
-            IMemAllocator_Release(This->pAllocator);
-        This->pAllocator = NULL;
-        CoTaskMemFree(This);
+        BaseOutputPin_Destroy(This);
         return 0;
     }
     return refCount;
@@ -849,6 +845,16 @@ HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outp
     return E_FAIL;
 }
 
+HRESULT WINAPI BaseOutputPin_Destroy(BaseOutputPin *This)
+{
+    FreeMediaType(&This->pin.mtCurrent);
+    if (This->pAllocator)
+        IMemAllocator_Release(This->pAllocator);
+    This->pAllocator = NULL;
+    CoTaskMemFree(This);
+    return S_OK;
+}
+
 /*** Input Pin implementation ***/
 
 static inline BaseInputPin *impl_BaseInputPin_from_IPin( IPin *iface )
@@ -900,12 +906,7 @@ ULONG WINAPI BaseInputPinImpl_Release(IPin * iface)
 
     if (!refCount)
     {
-        FreeMediaType(&This->pin.mtCurrent);
-        if (This->pAllocator)
-            IMemAllocator_Release(This->pAllocator);
-        This->pAllocator = NULL;
-        This->pin.IPin_iface.lpVtbl = NULL;
-        CoTaskMemFree(This);
+        BaseInputPin_Destroy(This);
         return 0;
     }
     else
@@ -1273,3 +1274,14 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size
     CoTaskMemFree(pPinImpl);
     return E_FAIL;
 }
+
+HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This)
+{
+    FreeMediaType(&This->pin.mtCurrent);
+    if (This->pAllocator)
+        IMemAllocator_Release(This->pAllocator);
+    This->pAllocator = NULL;
+    This->pin.IPin_iface.lpVtbl = NULL;
+    CoTaskMemFree(This);
+    return S_OK;
+}
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index 1370198..841359d 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -136,6 +136,7 @@ HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputP
 HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin *This, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
 
 HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
+HRESULT WINAPI BaseOutputPin_Destroy(BaseOutputPin *This);
 
 /* Base Input Pin */
 HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
@@ -151,6 +152,7 @@ HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart,
 HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo,
         const BaseInputPinFuncTable* pBaseInputFuncsTable,
         LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
+HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This);
 
 typedef struct BaseFilter
 {
-- 
1.9.0.msysgit.0



More information about the wine-patches mailing list