Zhiyi Zhang : comctl32: Fix memory leaks.

Alexandre Julliard julliard at winehq.org
Mon Mar 1 15:54:04 CST 2021


Module: wine
Branch: master
Commit: a8502312c60fe9fe0bd2aec78553b78325832e11
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a8502312c60fe9fe0bd2aec78553b78325832e11

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Mon Mar  1 11:09:48 2021 +0800

comctl32: Fix memory leaks.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/edit.c     | 4 +++-
 dlls/comctl32/listview.c | 1 +
 dlls/comctl32/treeview.c | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index f84ef1eb168..a4bca2f9306 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -2514,7 +2514,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);
 			EDIT_NOTIFY_PARENT(es, EN_MAXTEXT);
 		}
 	}
@@ -3674,6 +3674,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);
 }
 
 /*********************************************************************
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 0c80b6164a9..0a05c0668ae 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -10645,6 +10645,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;
 }
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 7f9a6f88cee..0e4a92a466f 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -5468,6 +5468,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;
 }




More information about the wine-cvs mailing list