mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-05 21:50:00 +00:00
Do not call thread attach/detach routines during process exit to avoid
potential deadlocks.
This commit is contained in:
parent
cb0ce33877
commit
014a8bb1e3
|
@ -28,6 +28,7 @@ WINE_MODREF *MODULE_modref_list = NULL;
|
||||||
|
|
||||||
static WINE_MODREF *exe_modref;
|
static WINE_MODREF *exe_modref;
|
||||||
static int free_lib_count; /* recursion depth of FreeLibrary calls */
|
static int free_lib_count; /* recursion depth of FreeLibrary calls */
|
||||||
|
static int process_detaching; /* set on process detach to avoid deadlocks with thread detach */
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* MODULE32_LookupHMODULE
|
* MODULE32_LookupHMODULE
|
||||||
|
@ -215,7 +216,7 @@ void MODULE_DllProcessDetach( BOOL bForceDetach, LPVOID lpReserved )
|
||||||
WINE_MODREF *wm;
|
WINE_MODREF *wm;
|
||||||
|
|
||||||
RtlAcquirePebLock();
|
RtlAcquirePebLock();
|
||||||
|
if (bForceDetach) process_detaching = 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
for ( wm = MODULE_modref_list; wm; wm = wm->next )
|
for ( wm = MODULE_modref_list; wm; wm = wm->next )
|
||||||
|
@ -250,6 +251,10 @@ void MODULE_DllThreadAttach( LPVOID lpReserved )
|
||||||
{
|
{
|
||||||
WINE_MODREF *wm;
|
WINE_MODREF *wm;
|
||||||
|
|
||||||
|
/* don't do any attach calls if process is exiting */
|
||||||
|
if (process_detaching) return;
|
||||||
|
/* FIXME: there is still a race here */
|
||||||
|
|
||||||
RtlAcquirePebLock();
|
RtlAcquirePebLock();
|
||||||
|
|
||||||
for ( wm = MODULE_modref_list; wm; wm = wm->next )
|
for ( wm = MODULE_modref_list; wm; wm = wm->next )
|
||||||
|
@ -280,6 +285,10 @@ void MODULE_DllThreadDetach( LPVOID lpReserved )
|
||||||
{
|
{
|
||||||
WINE_MODREF *wm;
|
WINE_MODREF *wm;
|
||||||
|
|
||||||
|
/* don't do any detach calls if process is exiting */
|
||||||
|
if (process_detaching) return;
|
||||||
|
/* FIXME: there is still a race here */
|
||||||
|
|
||||||
RtlAcquirePebLock();
|
RtlAcquirePebLock();
|
||||||
|
|
||||||
for ( wm = MODULE_modref_list; wm; wm = wm->next )
|
for ( wm = MODULE_modref_list; wm; wm = wm->next )
|
||||||
|
|
Loading…
Reference in a new issue