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)
{
void *retval;
int freed;
MSVCRT_new_handler_func handler;
do
{
......@@ -141,12 +142,11 @@ void* CDECL MSVCRT_operator_new(MSVCRT_size_t size)
return retval;
}
LOCK_HEAP;
if(MSVCRT_new_handler)
freed = (*MSVCRT_new_handler)(size);
handler = MSVCRT_new_handler;
if(handler)
freed = (*handler)(size);
else
freed = 0;
UNLOCK_HEAP;
} while(freed);
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