Have threads and processes exit more cleanly whenever possible.
diff --git a/loader/module.c b/loader/module.c
index ea528f4..6380919 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -221,14 +221,13 @@
* Send DLL process detach notifications. See the comment about calling
* sequence at MODULE_DllProcessAttach. Unless the bForceDetach flag
* is set, only DLLs with zero refcount are notified.
- *
- * NOTE: Assumes that the process critical section is held!
- *
*/
void MODULE_DllProcessDetach( BOOL bForceDetach, LPVOID lpReserved )
{
WINE_MODREF *wm;
+ EnterCriticalSection( &PROCESS_Current()->crit_section );
+
do
{
for ( wm = PROCESS_Current()->modref_list; wm; wm = wm->next )
@@ -248,6 +247,8 @@
break;
}
} while ( wm );
+
+ LeaveCriticalSection( &PROCESS_Current()->crit_section );
}
/*************************************************************************