[COMCTL32][USER32] EDIT & ListView & TreeView: Fix HRGN leaks (#6268)

Based on KRosUser's memleak_comctl32.patch.
JIRA issue: CORE-19405
Fix HRGN handle leaks.
This commit is contained in:
Katayama Hirofumi MZ 2024-01-04 18:05:39 +09:00 committed by GitHub
parent 77c5aea41f
commit 90432c1a4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View file

@ -2568,7 +2568,7 @@ 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);
SetRectRgn(hrgn, 0, 0, 0, 0);
if (!notify_parent(es, EN_MAXTEXT)) return;
}
}
@ -3734,6 +3734,8 @@ static void EDIT_WM_NCPaint(HWND hwnd, HRGN region)
/* Call default proc to get the scrollbars etc. also painted */
DefWindowProcW (hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0);
if (cliprgn != region)
DeleteObject(cliprgn);
}
/*********************************************************************

View file

@ -10817,6 +10817,7 @@ static BOOL LISTVIEW_NCPaint(const LISTVIEW_INFO *infoPtr, HRGN region)
/* Call default proc to get the scrollbars etc. painted */
DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)cliprgn, 0);
DeleteObject(cliprgn);
return FALSE;
}

View file

@ -5482,6 +5482,7 @@ static BOOL TREEVIEW_NCPaint (const TREEVIEW_INFO *infoPtr, HRGN region, LPARAM
/* Call default proc to get the scrollbars etc. painted */
DefWindowProcW (infoPtr->hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0);
DeleteObject(cliprgn);
return TRUE;
}

View file

@ -2761,7 +2761,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
abs(es->selection_end - es->selection_start) - strl, hrgn);
strl = 0;
e = s;
hrgn = CreateRectRgn(0, 0, 0, 0);
SetRectRgn(hrgn, 0, 0, 0, 0);
if (!notify_parent(es, EN_MAXTEXT)) return;
}
}