Commit 91ed0d79 authored by Martin Storsjo's avatar Martin Storsjo Committed by Alexandre Julliard

msvcrt: Don't lock the heap in operator_new.

The native msvcrt/msvcp allow two threads to be calling the new handler simultaneously. Signed-off-by: 's avatarMartin Storsjo <martin@martin.st> Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e66758dd
...@@ -131,6 +131,7 @@ void* CDECL MSVCRT_operator_new(MSVCRT_size_t size) ...@@ -131,6 +131,7 @@ void* CDECL MSVCRT_operator_new(MSVCRT_size_t size)
{ {
void *retval; void *retval;
int freed; int freed;
MSVCRT_new_handler_func handler;
do do
{ {
...@@ -141,12 +142,11 @@ void* CDECL MSVCRT_operator_new(MSVCRT_size_t size) ...@@ -141,12 +142,11 @@ void* CDECL MSVCRT_operator_new(MSVCRT_size_t size)
return retval; return retval;
} }
LOCK_HEAP; handler = MSVCRT_new_handler;
if(MSVCRT_new_handler) if(handler)
freed = (*MSVCRT_new_handler)(size); freed = (*handler)(size);
else else
freed = 0; freed = 0;
UNLOCK_HEAP;
} while(freed); } while(freed);
TRACE("(%ld) out of memory\n", size); TRACE("(%ld) out of memory\n", size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment