Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/user32/edit.c | 5 ++++- dlls/user32/nonclient.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 515341f65ea..4e8e7f7db44 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -2633,7 +2633,10 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r abs(es->selection_end - es->selection_start) - strl, hrgn); strl = 0; e = s; - hrgn = CreateRectRgn(0, 0, 0, 0); + if (hrgn) + SetRectRgn(hrgn, 0, 0, 0, 0); + else + hrgn = CreateRectRgn(0, 0, 0, 0); EDIT_NOTIFY_PARENT(es, EN_MAXTEXT); } } diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 8cfd3c0d371..e56c03deaf0 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -976,7 +976,11 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip ) hdc = GetDCEx( hwnd, hrgn, DCX_USESTYLE | DCX_WINDOW | DCX_EXCLUDERGN ); }
- if (!hdc) return; + if (!hdc) + { + DeleteObject( hrgn ); + return; + }
WIN_GetRectangles( hwnd, COORDS_WINDOW, &rect, NULL ); GetClipBox( hdc, &rectClip );