Stefan Dösinger : ddraw: Protect the ddraw list.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Oct 9 14:05:09 CDT 2006
Module: wine
Branch: master
Commit: 3543a070ff873f1e9d33cf18942155f94eb2d08f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3543a070ff873f1e9d33cf18942155f94eb2d08f
Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date: Mon Oct 9 15:18:11 2006 +0200
ddraw: Protect the ddraw list.
---
dlls/ddraw/main.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index 9fbcf35..7afe210 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -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 @@ #undef BLIT_CAPS
#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);
}
More information about the wine-cvs
mailing list