ddraw: Protect the ddraw list.

This commit is contained in:
Stefan Dösinger 2006-10-09 15:18:11 +02:00 committed by Alexandre Julliard
parent 09e794aff8
commit 3543a070ff
1 changed files with 15 additions and 0 deletions

View File

@ -58,8 +58,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
/* The configured default surface */
WINED3DSURFTYPE DefaultSurfaceType = SURFACE_UNKNOWN;
/* DDraw list and critical section */
static struct list global_ddraw_list = LIST_INIT(global_ddraw_list);
static CRITICAL_SECTION ddraw_list_cs;
static CRITICAL_SECTION_DEBUG ddraw_list_cs_debug =
{
0, 0, &ddraw_list_cs,
{ &ddraw_list_cs_debug.ProcessLocksList,
&ddraw_list_cs_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": ddraw_list_cs") }
};
static CRITICAL_SECTION ddraw_list_cs = { &ddraw_list_cs_debug, -1, 0, 0, 0, 0 };
/***********************************************************************
*
* Helper function for DirectDrawCreate and friends
@ -304,7 +315,9 @@ DDRAW_Create(GUID *guid,
#undef CKEY_CAPS
#undef FX_CAPS
EnterCriticalSection(&ddraw_list_cs);
list_add_head(&global_ddraw_list, &This->ddraw_list_entry);
LeaveCriticalSection(&ddraw_list_cs);
/* Call QueryInterface to get the pointer to the requested interface. This also initializes
* The required refcount
@ -929,5 +942,7 @@ DllMain(HINSTANCE hInstDLL,
void
remove_ddraw_object(IDirectDrawImpl *ddraw)
{
EnterCriticalSection(&ddraw_list_cs);
list_remove(&ddraw->ddraw_list_entry);
LeaveCriticalSection(&ddraw_list_cs);
}