[core,update] ensure EndPaint before DesktopResize

When DesktopResize is called EndPaint might not have been. Ensure the
update-lock is released and data flushed before resizing.
This commit is contained in:
akallabeth 2024-08-20 09:48:56 +02:00
parent a863bc0bf4
commit 63d87dcf18
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
3 changed files with 14 additions and 0 deletions

View File

@ -3335,9 +3335,12 @@ void rdp_update_unlock(rdpUpdate* update)
BOOL update_begin_paint(rdpUpdate* update)
{
rdp_update_internal* up = update_cast(update);
WINPR_ASSERT(update);
rdp_update_lock(update);
up->withinBeginEndPaint = TRUE;
WINPR_ASSERT(update->context);
BOOL rc = IFCALLRESULT(TRUE, update->BeginPaint, update->context);
@ -3370,6 +3373,13 @@ BOOL update_end_paint(rdpUpdate* update)
IFCALLRET(update->EndPaint, rc, update->context);
if (!rc)
WLog_WARN(TAG, "EndPaint call failed");
rdp_update_internal* up = update_cast(update);
if (!up->withinBeginEndPaint)
return rc;
up->withinBeginEndPaint = FALSE;
rdp_update_unlock(update);
return rc;
}

View File

@ -64,6 +64,7 @@ typedef struct
rdpBounds currentBounds;
rdpBounds previousBounds;
CRITICAL_SECTION mux;
BOOL withinBeginEndPaint;
} rdp_update_internal;
typedef struct

View File

@ -1295,6 +1295,9 @@ BOOL gdi_resize_ex(rdpGdi* gdi, UINT32 width, UINT32 height, UINT32 stride, UINT
WINPR_ASSERT(gdi->context);
WINPR_ASSERT(gdi->context->update);
/* EndPaint might not have been called, ensure the update lock is released */
update_end_paint(gdi->context->update);
rdp_update_lock(gdi->context->update);
if (gdi->drawing == gdi->primary)