Signed-off-by: Jacek Caban <ja...@codeweavers.com>
---
 mingw-w64-crt/misc/onexit_table.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


diff --git a/mingw-w64-crt/misc/onexit_table.c b/mingw-w64-crt/misc/onexit_table.c
index 50d9f3d0..69f2ea71 100644
--- a/mingw-w64-crt/misc/onexit_table.c
+++ b/mingw-w64-crt/misc/onexit_table.c
@@ -54,10 +54,14 @@ int __cdecl _register_onexit_function(_onexit_table_t *table, _onexit_t func)
 
 int __cdecl _execute_onexit_table(_onexit_table_t *table)
 {
-    _PVFV *first = table->_first;
-    _PVFV *last = table->_last;
+    _PVFV *first, *last;
 
+    _lock(_EXIT_LOCK1);
+    first = table->_first;
+    last = table->_last;
     _initialize_onexit_table(table);
+    _unlock(_EXIT_LOCK1);
+
     if (!first) return 0;
 
     while (--last >= first)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to