gdi32: Increment the reference count for the initial DC stock objects.

This commit is contained in:
Alexandre Julliard 2009-01-29 16:25:58 +01:00
parent 4b27dfec93
commit 827e1f1de3
3 changed files with 10 additions and 8 deletions

View File

@ -103,9 +103,9 @@ DC *alloc_dc_ptr( const DC_FUNCTIONS *funcs, WORD magic )
dc->hMetaRgn = 0;
dc->hMetaClipRgn = 0;
dc->hVisRgn = 0;
dc->hPen = GetStockObject( BLACK_PEN );
dc->hBrush = GetStockObject( WHITE_BRUSH );
dc->hFont = GetStockObject( SYSTEM_FONT );
dc->hPen = GDI_inc_ref_count( GetStockObject( BLACK_PEN ));
dc->hBrush = GDI_inc_ref_count( GetStockObject( WHITE_BRUSH ));
dc->hFont = GDI_inc_ref_count( GetStockObject( SYSTEM_FONT ));
dc->hBitmap = 0;
dc->hDevice = 0;
dc->hPalette = GetStockObject( DEFAULT_PALETTE );
@ -680,7 +680,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
if (!(dc = alloc_dc_ptr( funcs, OBJ_DC ))) goto error;
hdc = dc->hSelf;
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP ));
if (!(dc->hVisRgn = CreateRectRgn( 0, 0, 1, 1 ))) goto error;
TRACE("(driver=%s, device=%s, output=%s): returning %p\n",
@ -797,7 +797,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
TRACE("(%p): returning %p\n", hdc, dc->hSelf );
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP ));
if (!(dc->hVisRgn = CreateRectRgn( 0, 0, 1, 1 ))) goto error; /* default bitmap is 1x1 */
/* Copy the driver-specific physical device info into

View File

@ -442,7 +442,7 @@ extern void *free_gdi_handle( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern void *GDI_GetObjPtr( HGDIOBJ, WORD ) DECLSPEC_HIDDEN;
extern void GDI_ReleaseObj( HGDIOBJ ) DECLSPEC_HIDDEN;
extern void GDI_CheckNotLock(void) DECLSPEC_HIDDEN;
extern BOOL GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
extern BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;

View File

@ -522,7 +522,7 @@ static DWORD get_dpi( void )
*
* Increment the reference count of a GDI object.
*/
BOOL GDI_inc_ref_count( HGDIOBJ handle )
HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle )
{
GDIOBJHDR *header;
@ -531,7 +531,9 @@ BOOL GDI_inc_ref_count( HGDIOBJ handle )
header->dwCount++;
GDI_ReleaseObj( handle );
}
return header != NULL;
else handle = 0;
return handle;
}