Alexandre Julliard : gdi32: Fix a few more places that use the wrong
get/ release function for DCs.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Aug 23 07:25:52 CDT 2007
Module: wine
Branch: master
Commit: e9a4c2351d4317f214a51aa8de0740851ae45e04
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e9a4c2351d4317f214a51aa8de0740851ae45e04
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Aug 22 18:20:39 2007 +0200
gdi32: Fix a few more places that use the wrong get/release function for DCs.
---
dlls/gdi32/dc.c | 24 +++++++++++-------------
dlls/gdi32/gdiobj.c | 14 ++++----------
2 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 4bf19b4..a3689eb 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -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;
diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c
index f2dd4e1..0388c71 100644
--- a/dlls/gdi32/gdiobj.c
+++ b/dlls/gdi32/gdiobj.c
@@ -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 );
}
}
More information about the wine-cvs
mailing list