gdi32: Fix a few more places that use the wrong get/release function for DCs.

This commit is contained in:
Alexandre Julliard 2007-08-22 18:20:39 +02:00
parent 4fb26709cd
commit e9a4c2351d
2 changed files with 15 additions and 23 deletions

View File

@ -200,7 +200,7 @@ BOOL DC_FreeDCPtr( DC *dc )
*/
static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj )
{
DC_ReleaseDCPtr( obj );
GDI_ReleaseObj( handle );
return DeleteDC( handle );
}
@ -740,25 +740,23 @@ HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
HDC WINAPI CreateCompatibleDC( HDC hdc )
{
DC *dc, *origDC;
const DC_FUNCTIONS *funcs;
PHYSDEV physDev;
const DC_FUNCTIONS *funcs = NULL;
PHYSDEV physDev = NULL;
GDI_CheckNotLock();
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC )))
if ((origDC = DC_GetDCPtr( hdc )))
{
funcs = origDC->funcs;
physDev = origDC->physDev;
if (GetObjectType( hdc ) == OBJ_DC)
{
funcs = origDC->funcs;
physDev = origDC->physDev;
}
DC_ReleaseDCPtr( origDC ); /* can't hold the lock while loading the driver */
funcs = DRIVER_get_driver( funcs );
}
else
{
funcs = DRIVER_load_driver( displayW );
physDev = NULL;
if (funcs) funcs = DRIVER_get_driver( funcs );
}
if (!funcs) return 0;
if (!funcs && !(funcs = DRIVER_load_driver( displayW ))) return 0;
if (!(dc = DC_AllocDC( funcs, MEMORY_DC_MAGIC ))) goto error;

View File

@ -528,15 +528,9 @@ static DWORD get_dpi( void )
*
* Increment the reference count of a GDI object.
*/
static inline void inc_ref_count( HGDIOBJ handle )
static inline void inc_ref_count( GDIOBJHDR *header )
{
GDIOBJHDR *header;
if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
{
header->dwCount++;
GDI_ReleaseObj( handle );
}
header->dwCount++;
}
@ -829,7 +823,7 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
{
if(dc->funcs->pDeleteObject)
dc->funcs->pDeleteObject( dc->physDev, obj );
GDI_ReleaseObj( header->hdcs->hdc );
DC_ReleaseDCPtr( dc );
}
tmp = header->hdcs;
header->hdcs = header->hdcs->next;
@ -1159,7 +1153,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
ret = header->funcs->pSelectObject( hObj, header, hdc );
if (ret && ret != hObj && HandleToULong(ret) > COMPLEXREGION)
{
inc_ref_count( hObj );
inc_ref_count( header );
dec_ref_count( ret );
}
}