From: Zhao Yi zhaoyi@uniontech.com
Within the NtUserUpdateLayeredWindow function, there exists the following call sequence: window_surface_lock()->NtGdiAlphaBlend()->window_surface_unlock(). However, the implementation of the NtGdiAlphaBlend() function calls the windrv_GetImage() function, which internally invokes lock_surface() and unlock_surface(). In this situation, window_surface_lock() is called first to acquire a lock. When lock_surface() is subsequently called to acquire the same lock, the initial lock has not yet been released, ultimately resulting in a deadlock.
Signed-off-by: Zhao Yi zhaoyi@uniontech.com --- dlls/win32u/window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 7e7726f52f9..e420ebd1b39 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2550,7 +2550,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ intersect_rect( &rect, &rect, &surface_rect );
if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) goto done; - window_surface_lock( surface ); + if (surface != &dummy_surface) pthread_mutex_lock( &surfaces_lock ); NtGdiSelectBitmap( hdc, surface->color_bitmap );
if (dirty) intersect_rect( &rect, &rect, dirty ); @@ -2566,7 +2566,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ if (ret) add_bounds_rect( &surface->bounds, &rect );
NtGdiDeleteObjectApp( hdc ); - window_surface_unlock( surface ); + if (surface != &dummy_surface) pthread_mutex_unlock( &surfaces_lock );
if (!(flags & ULW_COLORKEY)) key = CLR_INVALID; window_surface_set_layered( surface, key, -1, 0xff000000 );