Author: rharabien Date: Mon Mar 28 20:52:27 2011 New Revision: 51184
URL: http://svn.reactos.org/svn/reactos?rev=51184&view=rev Log: [USER32] Fix a bug causing "Attempted to lock object, wrong reuse counter" messages when CMD was started in LiveCD. Once got desktop HDC was used in different threads. When thread, which created handle terminated, DC handle was removed and next calls to CreateIcon* API was using invalid hDC.
Modified: trunk/reactos/dll/win32/user32/windows/cursoricon.c
Modified: trunk/reactos/dll/win32/user32/windows/cursoricon.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/cu... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/cursoricon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/cursoricon.c [iso-8859-1] Mon Mar 28 20:52:27 2011 @@ -458,16 +458,10 @@ void *color_bits, *mask_bits; BOOL ret = FALSE; HDC hdc = 0; - static HDC hScreenDC = 0;
if (!(info = HeapAlloc( GetProcessHeap(), 0, max( size, FIELD_OFFSET( BITMAPINFO, bmiColors[2] ))))) return FALSE; - if(!hScreenDC) - { - hScreenDC = GetDC(0); - if(!hScreenDC) goto done; - } - if (!(hdc = CreateCompatibleDC(hScreenDC))) goto done; + if (!(hdc = CreateCompatibleDC(NULL))) goto done;
memcpy( info, bmi, size ); info->bmiHeader.biHeight /= 2; @@ -491,8 +485,8 @@ else { if (!(*mask = CreateBitmap( width, height, 1, 1, NULL ))) goto done; - if (!(*color = CreateBitmap( width, height, GetDeviceCaps(hScreenDC, PLANES), - GetDeviceCaps(hScreenDC, BITSPIXEL), NULL ))) + if (!(*color = CreateBitmap( width, height, GetDeviceCaps(hdc, PLANES), + GetDeviceCaps(hdc, BITSPIXEL), NULL ))) { DeleteObject( *mask ); goto done;