Zebediah Figura : strmbase: Forbid (dis)connecting pins if the filter is not stopped.

Alexandre Julliard julliard at winehq.org
Tue Nov 19 16:35:21 CST 2019


Module: wine
Branch: master
Commit: 2a6037e263ff3fae8ca82d90b0b141bea1cd473d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2a6037e263ff3fae8ca82d90b0b141bea1cd473d

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Nov 18 18:51:21 2019 -0600

strmbase: Forbid (dis)connecting pins if the filter is not stopped.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/strmbase/pin.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index c7f1ed2af4..8c337ca471 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -366,6 +366,13 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const
 
     EnterCriticalSection(&This->pin.filter->csFilter);
     {
+        if (This->pin.filter->state != State_Stopped)
+        {
+            LeaveCriticalSection(&This->pin.filter->csFilter);
+            WARN("Filter is not stopped; returning VFW_E_NOT_STOPPED.\n");
+            return VFW_E_NOT_STOPPED;
+        }
+
         /* if we have been a specific type to connect with, then we can either connect
          * with that or fail. We cannot choose different AM_MEDIA_TYPE */
         if (pmt && !IsEqualGUID(&pmt->majortype, &GUID_NULL) && !IsEqualGUID(&pmt->subtype, &GUID_NULL))
@@ -447,6 +454,13 @@ HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface)
 
     EnterCriticalSection(&This->pin.filter->csFilter);
     {
+        if (This->pin.filter->state != State_Stopped)
+        {
+            LeaveCriticalSection(&This->pin.filter->csFilter);
+            WARN("Filter is not stopped; returning VFW_E_NOT_STOPPED.\n");
+            return VFW_E_NOT_STOPPED;
+        }
+
         if (This->pMemInputPin)
         {
             IMemInputPin_Release(This->pMemInputPin);
@@ -730,6 +744,13 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP
 
     EnterCriticalSection(&This->pin.filter->csFilter);
     {
+        if (This->pin.filter->state != State_Stopped)
+        {
+            LeaveCriticalSection(&This->pin.filter->csFilter);
+            WARN("Filter is not stopped; returning VFW_E_NOT_STOPPED.\n");
+            return VFW_E_NOT_STOPPED;
+        }
+
         if (This->pin.peer)
             hr = VFW_E_ALREADY_CONNECTED;
 




More information about the wine-cvs mailing list