[PATCH 3/5] user32: Fix memory leaks.
Signed-off-by: Zhiyi Zhang <zzhang(a)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 ); -- 2.27.0
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86212 Your paranoid android. === debiant2 (32 bit report) === user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE === debiant2 (32 bit Chinese:China report) === comctl32: combo.c:1286: Test failed: Test 0, expected list height to be 480, got 464 combo.c:1286: Test failed: Test 1, expected list height to be 560, got 464 user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE === debiant2 (32 bit WoW report) === user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE === debiant2 (64 bit WoW report) === comctl32: combo.c:1286: Test failed: Test 0, expected list height to be 480, got 464 combo.c:1286: Test failed: Test 1, expected list height to be 560, got 464 user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE win.c:10120: Test failed: Expected foreground window 000E013E, got 00E10102 win.c:10122: Test failed: GetActiveWindow() = 00000000 win.c:10122: Test failed: GetFocus() = 00000000 win.c:10123: Test failed: Received WM_ACTIVATEAPP(1), did not expect it. win.c:10124: Test failed: Received WM_ACTIVATEAPP(0), did not expect it. win.c:10132: Test failed: Expected foreground window 000E013E, got 00000000 win.c:10134: Test failed: GetActiveWindow() = 00000000 win.c:10134: Test failed: GetFocus() = 00000000 win.c:10142: Test failed: Received WM_ACTIVATEAPP(1), did not expect it.
participants (2)
-
Marvin -
Zhiyi Zhang