cmd/tests: Add tests for FOR /F 'delims' option.
[wine] / dlls / gdi32 / gdiobj.c
index a941e2b..4d84342 100644 (file)
@@ -635,6 +635,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
 #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE)
 static GDIOBJHDR *large_handles[MAX_LARGE_HANDLES];
 static int next_large_handle;
+static LONG debug_count;
 
 static const char *gdi_obj_type( unsigned type )
 {
@@ -712,6 +713,9 @@ HGDIOBJ alloc_gdi_handle( GDIOBJHDR *obj, WORD type, const struct gdi_obj_funcs
     large_handles[i] = obj;
     next_large_handle = i;
     LeaveCriticalSection( &gdi_section );
+    TRACE( "allocated %s %p %u/%u\n",
+           gdi_obj_type(type), (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2),
+           InterlockedIncrement( &debug_count ), MAX_LARGE_HANDLES );
     return (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2);
 }
 
@@ -736,6 +740,8 @@ void *free_gdi_handle( HGDIOBJ handle )
     }
     if (object)
     {
+        TRACE( "freed %s %p %u/%u\n", gdi_obj_type( object->type ), handle,
+               InterlockedDecrement( &debug_count ) + 1, MAX_LARGE_HANDLES );
         object->type  = 0;  /* mark it as invalid */
         object->funcs = NULL;
     }
@@ -769,7 +775,6 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD type )
         LeaveCriticalSection( &gdi_section );
         WARN( "Invalid handle %p\n", handle );
     }
-    else TRACE("(%p): enter %d\n", handle, gdi_section.RecursionCount);
 
     return ptr;
 }
@@ -781,7 +786,6 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD type )
  */
 void GDI_ReleaseObj( HGDIOBJ handle )
 {
-    TRACE("(%p): leave %d\n", handle, gdi_section.RecursionCount);
     LeaveCriticalSection( &gdi_section );
 }
 
@@ -841,12 +845,10 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
 
         if(dc)
         {
-            if(dc->funcs->pDeleteObject)
-            {
-                GDI_ReleaseObj( obj );  /* release the GDI lock */
-                dc->funcs->pDeleteObject( dc->physDev, obj );
-                header = GDI_GetObjPtr( obj, 0 );  /* and grab it again */
-            }
+            PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDeleteObject );
+            GDI_ReleaseObj( obj );  /* release the GDI lock */
+            physdev->funcs->pDeleteObject( physdev, obj );
+            header = GDI_GetObjPtr( obj, 0 );  /* and grab it again */
             release_dc_ptr( dc );
         }
         HeapFree(GetProcessHeap(), 0, hdcs_head);
@@ -1276,10 +1278,11 @@ BOOL WINAPI GdiComment(HDC hdc, UINT cbSize, const BYTE *lpData)
 {
     DC *dc = get_dc_ptr(hdc);
     BOOL ret = FALSE;
+
     if(dc)
     {
-        if (dc->funcs->pGdiComment)
-            ret = dc->funcs->pGdiComment( dc->physDev, cbSize, lpData );
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGdiComment );
+        ret = physdev->funcs->pGdiComment( physdev, cbSize, lpData );
         release_dc_ptr( dc );
     }
     return ret;