ddraw: Hold the lock in IDirectDrawClipper methods.

This commit is contained in:
Stefan Dösinger 2007-05-20 23:51:26 +02:00 committed by Alexandre Julliard
parent d5d7d4dae4
commit 0086d490a9
1 changed files with 32 additions and 10 deletions

View File

@ -106,8 +106,10 @@ static ULONG WINAPI IDirectDrawClipperImpl_Release(IDirectDrawClipper *iface) {
if (ref == 0)
{
EnterCriticalSection(&ddraw_cs);
IWineD3DClipper_Release(This->wineD3DClipper);
HeapFree(GetProcessHeap(), 0, This);
LeaveCriticalSection(&ddraw_cs);
return 0;
}
else return ref;
@ -135,9 +137,11 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetHwnd(
HRESULT hr;
TRACE("(%p)->(%08x,%p)\n", This, dwFlags, hWnd);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DClipper_SetHWnd(This->wineD3DClipper,
dwFlags,
hWnd);
LeaveCriticalSection(&ddraw_cs);
switch(hr)
{
case WINED3DERR_INVALIDCALL: return DDERR_INVALIDPARAMS;
@ -168,12 +172,16 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetClipList(
LPDWORD lpdwSize)
{
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
HRESULT hr;
TRACE("(%p,%p,%p,%p)\n", This, lpRect, lpClipList, lpdwSize);
return IWineD3DClipper_GetClipList(This->wineD3DClipper,
lpRect,
lpClipList,
lpdwSize);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DClipper_GetClipList(This->wineD3DClipper,
lpRect,
lpClipList,
lpdwSize);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
/*****************************************************************************
@ -194,10 +202,14 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetClipList(
LPDIRECTDRAWCLIPPER iface,LPRGNDATA lprgn,DWORD dwFlag
) {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
HRESULT hr;
return IWineD3DClipper_SetClipList(This->wineD3DClipper,
lprgn,
dwFlag);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DClipper_SetClipList(This->wineD3DClipper,
lprgn,
dwFlag);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
/*****************************************************************************
@ -215,10 +227,14 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetHWnd(
LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr
) {
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
HRESULT hr;
TRACE("(%p)->(%p)\n", This, hWndPtr);
return IWineD3DClipper_GetHWnd(This->wineD3DClipper,
hWndPtr);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DClipper_GetHWnd(This->wineD3DClipper,
hWndPtr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
/*****************************************************************************
@ -242,11 +258,17 @@ static HRESULT WINAPI IDirectDrawClipperImpl_Initialize(
IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
TRACE("(%p)->(%p,0x%08x)\n", This, lpDD, dwFlags);
if (This->ddraw_owner != NULL) return DDERR_ALREADYINITIALIZED;
EnterCriticalSection(&ddraw_cs);
if (This->ddraw_owner != NULL)
{
LeaveCriticalSection(&ddraw_cs);
return DDERR_ALREADYINITIALIZED;
}
pOwner = ICOM_OBJECT(IDirectDrawImpl, IDirectDraw, lpDD);
This->ddraw_owner = pOwner;
LeaveCriticalSection(&ddraw_cs);
return DD_OK;
}