mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:41:12 +00:00
quartz: Use a safe APC to kill the PullPin thread when the PullPin is being released.
This commit is contained in:
parent
9d1f49cd9f
commit
b1bfae286f
1 changed files with 17 additions and 1 deletions
|
@ -1121,6 +1121,15 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
|
|||
return hr;
|
||||
}
|
||||
|
||||
static void CALLBACK PullPin_SafeThreadStop(ULONG_PTR handle)
|
||||
{
|
||||
HANDLE hThread = (HANDLE)handle;
|
||||
|
||||
if (hThread)
|
||||
CloseHandle(hThread);
|
||||
ExitThread(0);
|
||||
}
|
||||
|
||||
HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
|
||||
{
|
||||
PullPin *This = (PullPin *)iface;
|
||||
|
@ -1155,7 +1164,14 @@ ULONG WINAPI PullPin_Release(IPin * iface)
|
|||
if (!refCount)
|
||||
{
|
||||
if (This->hThread)
|
||||
PullPin_StopProcessing(This);
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (!QueueUserAPC(PullPin_SafeThreadStop, This->hThread, (ULONG_PTR)This->hThread))
|
||||
ERR("Cannot stop PullPin thread (GetLastError() = %d)!", GetLastError());
|
||||
if (This->pAlloc && FAILED(hr = IMemAllocator_Decommit(This->pAlloc)))
|
||||
ERR("Allocator decommit failed with error %x. Possible memory leak\n", hr);
|
||||
}
|
||||
if(This->pAlloc)
|
||||
IMemAllocator_Release(This->pAlloc);
|
||||
if(This->pReader)
|
||||
|
|
Loading…
Reference in a new issue