Thomas Faber : strmbase: Separate BasePin destructors from Release.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 28 20:50:43 CDT 2014


Module: wine
Branch: master
Commit: 4ea1f35777c17c2a8896c1bfdb0619c6e7a72eea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4ea1f35777c17c2a8896c1bfdb0619c6e7a72eea

Author: Thomas Faber <thomas.faber at reactos.org>
Date:   Sun Jul 27 11:34:50 2014 +0200

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
 {




More information about the wine-cvs mailing list