From 75c818eefba4b61c5aa3ebfcf5230ee241fd72f9 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Wed, 1 Feb 2012 03:09:57 +0000 Subject: [PATCH] [User32] - Attempt to fix the font leak when switching applications. Tested with other applications other than Acrobat Reader since it crashes when installing. See bug 5314. svn path=/trunk/; revision=55362 --- reactos/dll/win32/user32/controls/appswitch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/user32/controls/appswitch.c b/reactos/dll/win32/user32/controls/appswitch.c index f39c90f6d0b..6ff356c1f77 100644 --- a/reactos/dll/win32/user32/controls/appswitch.c +++ b/reactos/dll/win32/user32/controls/appswitch.c @@ -192,6 +192,7 @@ void OnPaint(HWND hWnd) int i; HBRUSH hBrush; HPEN hPen; + HFONT dcFont; COLORREF cr; int nch = GetWindowTextW(windowList[selectedWindow], windowText, 1023); @@ -230,7 +231,7 @@ void OnPaint(HWND hWnd) DrawIcon(dialogDC, xpos, ypos, hIcon); } - SelectObject(dialogDC, dialogFont); + dcFont = SelectObject(dialogDC, dialogFont); SetTextColor(dialogDC, GetSysColor(COLOR_BTNTEXT)); SetBkColor(dialogDC, GetSysColor(COLOR_BTNFACE)); @@ -239,6 +240,7 @@ void OnPaint(HWND hWnd) textRC.right = totalW - 8; textRC.bottom = totalH - 8; DrawTextW(dialogDC, windowText, nch, &textRC, DT_CENTER|DT_END_ELLIPSIS); + SelectObject(dialogDC, dcFont); } EndPaint(hWnd, &paint); }