Commit 0086d490 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: Hold the lock in IDirectDrawClipper methods.

parent d5d7d4da
......@@ -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;
}
......
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