[PATCH 1/5] user32: Add CRITICAL_SECTION cs member to struct window_surface.

Rémi Bernon rbernon at codeweavers.com
Mon May 10 02:55:09 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/wineandroid.drv/window.c | 13 ++++++-------
 dlls/winex11.drv/bitblt.c     | 13 ++++++-------
 include/wine/gdi_driver.h     |  2 ++
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index 1cb1bbbadc9..902f5980d13 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -587,7 +587,6 @@ struct android_window_surface
     BYTE                  alpha;
     COLORREF              color_key;
     void                 *bits;
-    CRITICAL_SECTION      crit;
     BITMAPINFO            info;   /* variable size, must be last */
 };
 
@@ -660,7 +659,7 @@ static void CDECL android_surface_lock( struct window_surface *window_surface )
 {
     struct android_window_surface *surface = get_android_surface( window_surface );
 
-    EnterCriticalSection( &surface->crit );
+    EnterCriticalSection( &surface->header.cs );
 }
 
 /***********************************************************************
@@ -670,7 +669,7 @@ static void CDECL android_surface_unlock( struct window_surface *window_surface
 {
     struct android_window_surface *surface = get_android_surface( window_surface );
 
-    LeaveCriticalSection( &surface->crit );
+    LeaveCriticalSection( &surface->header.cs );
 }
 
 /***********************************************************************
@@ -810,8 +809,8 @@ static void CDECL android_surface_destroy( struct window_surface *window_surface
 
     TRACE( "freeing %p bits %p\n", surface, surface->bits );
 
-    surface->crit.DebugInfo->Spare[0] = 0;
-    DeleteCriticalSection( &surface->crit );
+    surface->header.cs.DebugInfo->Spare[0] = 0;
+    DeleteCriticalSection( &surface->header.cs );
     HeapFree( GetProcessHeap(), 0, surface->region_data );
     if (surface->region) DeleteObject( surface->region );
     release_ioctl_window( surface->window );
@@ -920,8 +919,8 @@ static struct window_surface *create_surface( HWND hwnd, const RECT *rect,
     surface->info.bmiHeader.biPlanes      = 1;
     surface->info.bmiHeader.biSizeImage   = get_dib_image_size( &surface->info );
 
-    InitializeCriticalSection( &surface->crit );
-    surface->crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": surface");
+    InitializeCriticalSection( &surface->header.cs );
+    surface->header.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": surface");
 
     surface->header.funcs = &android_surface_funcs;
     surface->header.rect  = *rect;
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index fad183b0b01..b931fd88da3 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1573,7 +1573,6 @@ struct x11drv_window_surface
 #ifdef HAVE_LIBXXSHM
     XShmSegmentInfo       shminfo;
 #endif
-    CRITICAL_SECTION      crit;
     BITMAPINFO            info;   /* variable size, must be last */
 };
 
@@ -1821,7 +1820,7 @@ static void CDECL x11drv_surface_lock( struct window_surface *window_surface )
 {
     struct x11drv_window_surface *surface = get_x11_surface( window_surface );
 
-    EnterCriticalSection( &surface->crit );
+    EnterCriticalSection( &surface->header.cs );
 }
 
 /***********************************************************************
@@ -1831,7 +1830,7 @@ static void CDECL x11drv_surface_unlock( struct window_surface *window_surface )
 {
     struct x11drv_window_surface *surface = get_x11_surface( window_surface );
 
-    LeaveCriticalSection( &surface->crit );
+    LeaveCriticalSection( &surface->header.cs );
 }
 
 /***********************************************************************
@@ -1977,8 +1976,8 @@ static void CDECL x11drv_surface_destroy( struct window_surface *window_surface
         surface->image->data = NULL;
         XDestroyImage( surface->image );
     }
-    surface->crit.DebugInfo->Spare[0] = 0;
-    DeleteCriticalSection( &surface->crit );
+    surface->header.cs.DebugInfo->Spare[0] = 0;
+    DeleteCriticalSection( &surface->header.cs );
     if (surface->region) DeleteObject( surface->region );
     HeapFree( GetProcessHeap(), 0, surface );
 }
@@ -2016,8 +2015,8 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co
     surface->info.bmiHeader.biSizeImage   = get_dib_image_size( &surface->info );
     if (format->bits_per_pixel > 8) set_color_info( vis, &surface->info, use_alpha );
 
-    InitializeCriticalSection( &surface->crit );
-    surface->crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": surface");
+    InitializeCriticalSection( &surface->header.cs );
+    surface->header.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": surface");
 
     surface->header.funcs = &x11drv_surface_funcs;
     surface->header.rect  = *rect;
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index 124bb41f7d9..6c700664eb5 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -22,6 +22,7 @@
 #define __WINE_WINE_GDI_DRIVER_H
 
 #include "winternl.h"
+#include "winbase.h"
 #include "ddk/d3dkmthk.h"
 #include "wine/list.h"
 
@@ -251,6 +252,7 @@ struct window_surface
     struct list                        entry; /* entry in global list managed by user32 */
     LONG                               ref;   /* reference count */
     RECT                               rect;  /* constant, no locking needed */
+    CRITICAL_SECTION                   cs;    /* critical section for locking */
     /* driver-specific fields here */
 };
 
-- 
2.31.0




More information about the wine-devel mailing list