Commit cf1d2f5e authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Fix memory and sample leaks.

parent 36418d8a
...@@ -246,7 +246,6 @@ HRESULT WINAPI Parser_Stop(IBaseFilter * iface) ...@@ -246,7 +246,6 @@ HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
PullPin_PauseProcessing(This->pInputPin); PullPin_PauseProcessing(This->pInputPin);
PullPin_WaitForStateChange(This->pInputPin, INFINITE); PullPin_WaitForStateChange(This->pInputPin, INFINITE);
IAsyncReader_EndFlush(This->pInputPin->pReader);
LeaveCriticalSection(&pin->thread_lock); LeaveCriticalSection(&pin->thread_lock);
return S_OK; return S_OK;
......
...@@ -387,6 +387,8 @@ HRESULT WINAPI IPinImpl_Disconnect(IPin * iface) ...@@ -387,6 +387,8 @@ HRESULT WINAPI IPinImpl_Disconnect(IPin * iface)
{ {
IPin_Release(This->pConnectedTo); IPin_Release(This->pConnectedTo);
This->pConnectedTo = NULL; This->pConnectedTo = NULL;
FreeMediaType(&This->mtCurrent);
ZeroMemory(&This->mtCurrent, sizeof(This->mtCurrent));
hr = S_OK; hr = S_OK;
} }
else else
...@@ -944,7 +946,7 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI ...@@ -944,7 +946,7 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
(This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK)) (This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
{ {
hr = S_OK; hr = S_OK;
CoTaskMemFree(pmtCandidate); DeleteMediaType(pmtCandidate);
break; break;
} }
DeleteMediaType(pmtCandidate); DeleteMediaType(pmtCandidate);
...@@ -967,7 +969,7 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI ...@@ -967,7 +969,7 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
(This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK)) (This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
{ {
hr = S_OK; hr = S_OK;
CoTaskMemFree(pmtCandidate); DeleteMediaType(pmtCandidate);
break; break;
} }
DeleteMediaType(pmtCandidate); DeleteMediaType(pmtCandidate);
...@@ -1008,6 +1010,8 @@ HRESULT WINAPI OutputPin_Disconnect(IPin * iface) ...@@ -1008,6 +1010,8 @@ HRESULT WINAPI OutputPin_Disconnect(IPin * iface)
{ {
IPin_Release(This->pin.pConnectedTo); IPin_Release(This->pin.pConnectedTo);
This->pin.pConnectedTo = NULL; This->pin.pConnectedTo = NULL;
FreeMediaType(&This->pin.mtCurrent);
ZeroMemory(&This->pin.mtCurrent, sizeof(This->pin.mtCurrent));
hr = S_OK; hr = S_OK;
} }
else else
...@@ -1559,6 +1563,8 @@ static void CALLBACK PullPin_Thread_Process(PullPin *This) ...@@ -1559,6 +1563,8 @@ static void CALLBACK PullPin_Thread_Process(PullPin *This)
static void CALLBACK PullPin_Thread_Pause(PullPin *This) static void CALLBACK PullPin_Thread_Pause(PullPin *This)
{ {
PullPin_Flush(This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
This->state = Req_Sleepy; This->state = Req_Sleepy;
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
...@@ -1583,16 +1589,6 @@ static void CALLBACK PullPin_Thread_Stop(PullPin *This) ...@@ -1583,16 +1589,6 @@ static void CALLBACK PullPin_Thread_Stop(PullPin *This)
ExitThread(0); ExitThread(0);
} }
static void CALLBACK PullPin_Thread_Flush(PullPin *This)
{
PullPin_Flush(This);
EnterCriticalSection(This->pin.pCritSec);
This->state = Req_Sleepy;
SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec);
}
static DWORD WINAPI PullPin_Thread_Main(LPVOID pv) static DWORD WINAPI PullPin_Thread_Main(LPVOID pv)
{ {
PullPin *This = pv; PullPin *This = pv;
...@@ -1611,7 +1607,6 @@ static DWORD WINAPI PullPin_Thread_Main(LPVOID pv) ...@@ -1611,7 +1607,6 @@ static DWORD WINAPI PullPin_Thread_Main(LPVOID pv)
case Req_Die: PullPin_Thread_Stop(This); break; case Req_Die: PullPin_Thread_Stop(This); break;
case Req_Run: PullPin_Thread_Process(This); break; case Req_Run: PullPin_Thread_Process(This); break;
case Req_Pause: PullPin_Thread_Pause(This); break; case Req_Pause: PullPin_Thread_Pause(This); break;
case Req_Flush: PullPin_Thread_Flush(This); break;
case Req_Sleepy: ERR("Should not be signalled with SLEEPY!\n"); break; case Req_Sleepy: ERR("Should not be signalled with SLEEPY!\n"); break;
default: ERR("Unknown state request: %d\n", This->state); break; default: ERR("Unknown state request: %d\n", This->state); break;
} }
...@@ -1768,11 +1763,6 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface) ...@@ -1768,11 +1763,6 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface)
PullPin_PauseProcessing(This); PullPin_PauseProcessing(This);
PullPin_WaitForStateChange(This, INFINITE); PullPin_WaitForStateChange(This, INFINITE);
} }
This->state = Req_Flush;
ResetEvent(This->hEventStateChanged);
SetEvent(This->thread_sleepy);
PullPin_WaitForStateChange(This, INFINITE);
} }
LeaveCriticalSection(&This->thread_lock); LeaveCriticalSection(&This->thread_lock);
...@@ -1828,6 +1818,9 @@ HRESULT WINAPI PullPin_Disconnect(IPin *iface) ...@@ -1828,6 +1818,9 @@ HRESULT WINAPI PullPin_Disconnect(IPin *iface)
IPin_Release(This->pin.pConnectedTo); IPin_Release(This->pin.pConnectedTo);
This->pin.pConnectedTo = NULL; This->pin.pConnectedTo = NULL;
PullPin_StopProcessing(This); PullPin_StopProcessing(This);
FreeMediaType(&This->pin.mtCurrent);
ZeroMemory(&This->pin.mtCurrent, sizeof(This->pin.mtCurrent));
hr = S_OK; hr = S_OK;
} }
else else
......
...@@ -140,7 +140,6 @@ typedef struct PullPin ...@@ -140,7 +140,6 @@ typedef struct PullPin
#define Req_Die 1 #define Req_Die 1
#define Req_Run 2 #define Req_Run 2
#define Req_Pause 3 #define Req_Pause 3
#define Req_Flush 4
/*** Constructors ***/ /*** Constructors ***/
HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PUSH pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PUSH pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment