[PATCH 0/1] MR9025: winex11: Avoid presenting invalid offscreen window rects.
From: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/winex11.drv/init.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index c9854c1dbda..039c4b0fefd 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -202,7 +202,7 @@ static BOOL needs_client_window_clipping( HWND hwnd ) HRGN region; HDC hdc; - NtUserGetClientRect( hwnd, &client, NtUserGetDpiForWindow( hwnd ) ); + if (!NtUserGetClientRect( hwnd, &client, NtUserGetDpiForWindow( hwnd ) )) return FALSE; OffsetRect( &client, -client.left, -client.top ); if (!(hdc = NtUserGetDCEx( hwnd, 0, DCX_CACHE | DCX_USESTYLE ))) return FALSE; @@ -306,7 +306,7 @@ static void client_surface_update_size( HWND hwnd, struct x11drv_client_surface XWindowChanges changes; RECT rect; - NtUserGetClientRect( hwnd, &rect, NtUserGetDpiForWindow( hwnd ) ); + if (!NtUserGetClientRect( hwnd, &rect, NtUserGetDpiForWindow( hwnd ) )) return; if (EqualRect( &surface->rect, &rect )) return; changes.width = min( max( 1, rect.right ), 65535 ); @@ -397,7 +397,7 @@ static void X11DRV_client_surface_present( struct client_surface *client, HDC hd window = X11DRV_get_whole_window( toplevel ); region = get_dc_monitor_region( hwnd, hdc ); - NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); + if (!NtUserGetClientRect( hwnd, &rect_dst, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) )) goto done; NtUserMapWindowPoints( hwnd, toplevel, (POINT *)&rect_dst, 2, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); if ((data = get_win_data( toplevel ))) @@ -414,6 +414,7 @@ static void X11DRV_client_surface_present( struct client_surface *client, HDC hd NtGdiStretchBlt( surface->hdc_dst, 0, 0, rect_dst.right - rect_dst.left, rect_dst.bottom - rect_dst.top, surface->hdc_src, 0, 0, surface->rect.right, surface->rect.bottom, SRCCOPY, 0 ); +done: if (region) NtGdiDeleteObjectApp( region ); } @@ -435,7 +436,11 @@ Window x11drv_client_surface_create( HWND hwnd, const XVisualInfo *visual, Color client_surface_release( &surface->client ); return None; } - NtUserGetClientRect( hwnd, &surface->rect, NtUserGetDpiForWindow( hwnd ) ); + if (!NtUserGetClientRect( hwnd, &surface->rect, NtUserGetDpiForWindow( hwnd ) )) + { + client_surface_release( &surface->client ); + return None; + } TRACE( "Created %s for client window %lx\n", debugstr_client_surface( &surface->client ), surface->window ); *client = &surface->client; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9025
participants (1)
-
Rémi Bernon