winecfg: Do not overwrite theme each time an item is drawn.

Sebastian Lackner sebastian at fds-team.de
Tue Aug 18 23:24:19 CDT 2015


From: Michael Müller <michael at fds-team.de>

Fixes a leak and use-after-free. Calling OpenThemeDataEx() with a non-NULL hWnd
changes the atWindowTheme property, which leaks the previous theme. After the
following CloseThemeData() call the pointer gets invalid.

---
 programs/winecfg/theme.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c
index 8bc3c88..1f4818b 100644
--- a/programs/winecfg/theme.c
+++ b/programs/winecfg/theme.c
@@ -1094,7 +1094,7 @@ static void on_draw_item(HWND hDlg, WPARAM wParam, LPARAM lParam)
         HTHEME theme;
         RECT buttonrect;
 
-        theme = OpenThemeData(draw_info->hwndItem, WC_BUTTONW);
+        theme = OpenThemeData(NULL, WC_BUTTONW);
 
         if (theme) {
             MARGINS margins;
-- 
2.5.0



More information about the wine-patches mailing list